Return-Path: Delivered-To: apmail-perl-modperl-archive@www.apache.org Received: (qmail 90973 invoked from network); 3 Apr 2008 15:48:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Apr 2008 15:48:54 -0000 Received: (qmail 65333 invoked by uid 500); 3 Apr 2008 15:48:49 -0000 Delivered-To: apmail-perl-modperl-archive@perl.apache.org Received: (qmail 64899 invoked by uid 500); 3 Apr 2008 15:48:48 -0000 Mailing-List: contact modperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list modperl@perl.apache.org Received: (qmail 64888 invoked by uid 99); 3 Apr 2008 15:48:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Apr 2008 08:48:48 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of peng.kyo@gmail.com designates 209.85.142.188 as permitted sender) Received: from [209.85.142.188] (HELO ti-out-0910.google.com) (209.85.142.188) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Apr 2008 15:48:06 +0000 Received: by ti-out-0910.google.com with SMTP id a21so1180172tia.16 for ; Thu, 03 Apr 2008 08:48:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; bh=beNSvLTM64/gFyrEvmpeWNCmm92JAoE4USgvE9LBX7Y=; b=aDO3YJbC2kmj3jTyuo0Y1V8oH4PPWblzCcToPY4xCw6KMaatIlwoBaE8EIyFulks1Ck7bwKS35XSuF/ibugDhjJMu46ixCLZMYfZKcZIIhHLGBSS7MTsowwtz1bYuyCJX/Bsp7+h5JkvnV4YQcf/YcGJC/L+IFj0lwPmozTWeeo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=oxzhgy4Acf6+cRjqbN3vtj5Vi9ogQCOcj9WaJF1VmhknacZA/vm3lgDvo8WBE9lfNvgNRPBqQ5u/aLN5b3C7WLUfc690HI3cDlC7IeuJY/Hvt69rsBFPAk1ccEPL1pghrXJXwFSXhmOoJkRI72f8o12Vr8xKhijOPfNVFGNbOd0= Received: by 10.150.228.2 with SMTP id a2mr504924ybh.59.1207237695199; Thu, 03 Apr 2008 08:48:15 -0700 (PDT) Received: by 10.150.145.12 with HTTP; Thu, 3 Apr 2008 08:48:15 -0700 (PDT) Message-ID: <18c1e5f20804030848r77bb9b00r5d2ffc50ae75aec6@mail.gmail.com> Date: Thu, 3 Apr 2008 23:48:15 +0800 From: "Jeff Pang" Sender: peng.kyo@gmail.com To: modperl@perl.apache.org Subject: Re: share objects In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: X-Google-Sender-Auth: 757c1da9d126e300 X-Virus-Checked: Checked by ClamAV on apache.org On Thu, Apr 3, 2008 at 11:32 PM, Felipe de Jes=FAs Molina Bravo wrote: > hi > > I have installed static mp2 with apache 2.0.63 (forker). I am using per= l > bind (Sleepycat::DBXML) from dbxml; then I create an object (reference to > Sleepycat::DBXML) in startup.pl because i want to share it. After some te= st > (stress it) for my application I saw some error in error.log; the problem= is > that reference to object created in startup.pl 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 startup.pl, my $obj =3D 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 =3D Sleepycat::DBXML->new; sub initobj { $obj } 1; And put 'use MyPKG' in the startup.pl. then in your scripts you can access this object by saying 'our $obj' or via the method of 'my $obj =3D MyPKG->initobj'. Good luck.