Rodney Broom <[EMAIL PROTECTED]> said something to this effect on 06/25/2001:
> Hi all,
> 
> I'd like a way to store complex data structures across Apache
> processes. I've looked at Apache::DBI for an example: my tests
> say that he has to create a new dbh for every process. I've
> looked at IPC::Shareable, but it has to copy data. Meaning that
> I can only have a certain amount of complexity to my data
> structures.
> 
> Thoughts?

Apache::Session, currently at 1.53. Here's an except from the
perldoc:

 Sharing data between Apache processes

 When you share data between Apache processes, you need to decide
 on a session ID number ahead of time and make sure that an object
 with that ID number is in your object store before starting you
 Apache.  How you accomplish that is your own business.  I use the
 session ID "1".  Here is a short program in which we use
 Apache::Session to store out database access information.

   use Apache;
   use Apache::Session::File;
   use DBI;

   use strict;

   my %global_data;

   eval {
       tie %global_data, 'Apache::Session::File', 1,
          {Directory => '/tmp/sessiondata'};
   };
   if ($@) {
      die "Global data is not accessible: $@";
   }

   my $dbh = DBI->connect($global_data{datasource},
      $global_data{username}, $global_data{password})
      || die $DBI::errstr;

   undef %global_data;

   #program continues...

 As shown in this example, you should undef or untie your session
 hash as soon as you are done with it.  This will free up any
 locks associated with your process.

Is this what you are looking for?

(darren)

-- 
Make no laws whatever concerning speech, and speech will be free; so soon
as you make a declaration on paper that speech shall be free, you will have
a hundred lawyers proving that "freedom does not mean abuse, nor liberty
license"; and they will define and define freedom out of existence.  
    -- Voltarine de Cleyre

Reply via email to