perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Pang" <>
Subject Re: share objects
Date Thu, 03 Apr 2008 15:48:15 GMT
On Thu, Apr 3, 2008 at 11:32 PM, Felipe de Jesús Molina Bravo
<> wrote:
> hi
> I have  installed static mp2 with apache 2.0.63 (forker).  I am using perl
> bind (Sleepycat::DBXML) from dbxml; then I create an object (reference to
> Sleepycat::DBXML) in because i want to share it. After some test
> (stress it) for my application I saw some error in error.log; the problem is
> that reference to object created in was lost
> then the question is ... is possible to share objects?

If your object has its own package name space, you can share it
between multi-processes.
But if you state this in,

my $obj = Sleepycat::DBXML->new();

this $obj can't be shared among multi-processes. Because it doesn't
have its package name space.

So,you'd better write a package to encap that object, like:

package MyPKG;
use strict;
use Sleepycat::DBXML;

our $obj =  Sleepycat::DBXML->new;
sub initobj { $obj }


And put 'use MyPKG' in the
then in your scripts you can access this object by saying 'our $obj'
or via the method of 'my $obj = MyPKG->initobj'.

Good luck.

View raw message