Return-Path: Delivered-To: apmail-perl-embperl-archive@www.apache.org Received: (qmail 89717 invoked from network); 26 Jul 2010 00:48:06 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 26 Jul 2010 00:48:06 -0000 Received: (qmail 93981 invoked by uid 500); 26 Jul 2010 00:48:06 -0000 Delivered-To: apmail-perl-embperl-archive@perl.apache.org Received: (qmail 93942 invoked by uid 500); 26 Jul 2010 00:48:05 -0000 Mailing-List: contact embperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list embperl@perl.apache.org Received: (qmail 93935 invoked by uid 99); 26 Jul 2010 00:48:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Jul 2010 00:48:05 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [203.58.0.132] (HELO smtp.oriel.com.au) (203.58.0.132) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 26 Jul 2010 00:47:59 +0000 Received: from waldorf.oriel.com.au (waldorf.oriel.com.au [192.168.12.41]) by smtp.oriel.com.au (Postfix) with ESMTP id 5FCD4294AE; Mon, 26 Jul 2010 11:03:05 +1000 (EST) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: @param seems to be shared between Execute calls Date: Mon, 26 Jul 2010 10:47:32 +1000 Message-ID: In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: @param seems to be shared between Execute calls thread-index: AcsqSicFS3nJz8bEQ/SbcHppeMf1oACDkrIA References: From: "Andrew O'Brien" To: "Michael Smith" Cc: X-Oriel-MailScanner-ESVA-Watermark: 1280710986.14478@IeReqiwz7Q/SVfoaSlPUHA X-Oriel-MailScanner-ESVA-Information: Please contact for more information X-Oriel-MailScanner-ESVA-ID: 5FCD4294AE.50BC5 X-Oriel-MailScanner-ESVA: Found to be clean X-Oriel-MailScanner-ESVA-From: andrewo@oriel.com.au X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No Hi Michael, > Thanks for the email. I'm actually using @param to return=20 > data (as well as the HTML) to the epl script which is calling=20 > another one via Execute. Perhaps there's a better way. I think you may just be missing one piece of the puzzle: using references with the param argument to the Execute function. To slightly rewrite an example posted previously: use Embperl; use Data::Dumper; my $data =3D {}; my $output1; my $input =3D '[- $param[0]->{hello} =3D 42; -]'; Embperl::Execute({ inputfile =3D> "blah", input =3D> \$input, output =3D> \$output1, param =3D> [ $data ], }); print "Execute of file 1, data is currently set to:\n" . Dumper($data); my $output2; my $input2 =3D 'Hello! I was executed with the following arguments: [+ = do { use Data::Dumper; Dumper(\@param); } +]'; Embperl::Execute({ inputfile =3D> "blah", input =3D> \$input2, output =3D> \$output2, param =3D> [ $data ], }); print "Execute of file 2, data is currently set to:\n" . Dumper($data); print "Output of Execute() call: $output2 "; This yields: Execute of file 1, data is currently set to: $VAR1 =3D { 'hello' =3D> 42 }; Execute of file 2, data is currently set to: $VAR1 =3D { 'hello' =3D> 42 }; Output of Execute() call: Hello! I was executed with the following arguments: $VAR1 =3D [ { 'hello' =3D> 42 } ]; > On Fri, Jul 23, 2010 at 4:38 AM, Ed Grimm=20 > wrote: >=20 >=20 > If your Embperl pages are calling regular perl module=20 > code that uses @param, couldn't you just pass it from your=20 > Embperl page as a parameter, rather than using it as a global?=20 > =09 > Alternatively, if you are talking about code within an=20 > Embperl page, how do you process those without going through=20 > Execute? Note that the standard apache handler calls=20 > Execute, last I checked. I seem to recall there's a few=20 > other methods to run Embperl pages - but ultimately, they all=20 > call Execute. Disclaimer: I haven't looked in a while, and=20 > it's late, and I'm tired. > =09 > --=20 > Ed Grimm > Identity Services=20 > =09 > =09 > =09 > From: Michael Smith =09 > To: Gerald Richter - ECOS =20 > Cc: embperl@perl.apache.org, Michael Stevens=20 > ,=20 > cabell.demarcellus@dianomi.com, Michael Smith=20 > =09 > Date: 07/22/2010 06:25 PM =09 > Subject: Re: @param seems to be shared between Execute calls=09 >=20 > ________________________________ >=20 >=20 >=20 >=20 > Thanks Gerald,=20 > =09 > That's good to know for the future. Is there a way to=20 > know if the code has been called through Execute? I am=20 > actually using the same code both directly and via Execute.=20 > =09 > Michael > =09 > On Wed, Jul 21, 2010 at 10:19 AM, Gerald Richter - ECOS=20 > > wrote:=20 > Hi Michael,=20 >=20 > =20 >=20 > @param is only intented to be used to pass parameters=20 > to Execute. Setting it directly might work or might not...=20 >=20 > =20 >=20 > If you want to share data inside a request use=20 >=20 > =20 >=20 > $epreq -> {test} =3D 1 ;=20 >=20 > =20 >=20 > The hash of $epreq is not used by Embperl itself, so=20 > you are free to use it and it exists exactly for the live=20 > time of one Apache request=20 >=20 > =20 >=20 > Gerald=20 >=20 > =20 >=20 > =20 >=20 > =20 >=20 > From: Michael Smith [mailto:smithm@gmail.com=20 > ]=20 > Sent: Wednesday, July 21, 2010 11:05 AM=20 >=20 > =09 > To: embperl@perl.apache.org =20 > Cc: Michael Stevens; cabell.demarcellus@dianomi.com=20 > ; Michael Smith > Subject: Re: @param seems to be shared between Execute calls=20 >=20 > =20 >=20 > My problem is slightly different - though possibly a=20 > manifestation of the same thing. I find that param isn't=20 > cleaned up between requests.=20 >=20 > =20 >=20 > I have two epl files:=20 >=20 > =20 >=20 > set.epl:=20 >=20 > [- $param[0]->{'test'} =3D 1 -]=20 >=20 > =20 >=20 > get.epl=20 >=20 > [+ Dumper(@param) +]=20 >=20 > =20 >=20 > I find that the data from set.epl turns up when I make=20 > a subsequent request for get.epl (in practice it's a bit more=20 > random than that if one is running multiple processes, so I=20 > make a few requests for set.epl and then a few for get.epl)=20 >=20 > =20 >=20 > This only seems to be relevant if I reference param in=20 > the epl file I am calling directly. If I reference it in epl=20 > files which are loaded in by Execute, then they do appear to=20 > get cleaned up.=20 >=20 > =20 >=20 > Michael=20 >=20 > =20 >=20 > =20 >=20 > On Tue, Jul 20, 2010 at 10:20 PM, Ed Grimm=20 > > wrote:=20 >=20 > Note that, under Apache, the cleanup code happens at=20 > the end of each request - each of which could have dozens of=20 > Execute calls, between which it is very definitely NOT called.=20 > =09 > I have not used Embperl much from within server=20 > scripts, but in my limited use there, I've never seen the=20 > cleanup code fire. I suspect each script is considered 'a=20 > request' for the purposes of the cleanup code (well, as far=20 > as docs are concerned. I don't know if the code actually=20 > fires on END.) > =09 > --=20 > Ed Grimm > Identity Services=20 > =09 >=20 > =09 >=20 > From: Michael Stevens > =09 > To: embperl@perl.apache.org =09 > Cc: Michael Smith >,=20 > cabell.demarcellus@dianomi.com=20 > =09 > Date: 07/20/2010 10:12 AM =09 > Subject: @param seems to be shared between Execute calls=09 >=20 > =20 >=20 > =09 >=20 > ________________________________ >=20 > =09 >=20 > =09 > =09 > =09 > Hi. > =09 > We're seeing an odd bug where @param seems to be shared=20 > between Execute=20 > calls in the same process. The following code is a test=20 > case for this: > =09 > #!/usr/bin/perl -w > =09 > use strict; > use Embperl; > =09 > my $output1; > =09 > my $input =3D '[- $param[0]->{hello} =3D 42; -]'; > =09 > Embperl::Execute({ > inputfile =3D> "blah", > input =3D> \$input, > output =3D> \$output1, > }); > =09 > my $output2; > my $input2 =3D '[- use Data::Dumper; print Dumper(\@param); -]'; > =09 > Embperl::Execute({ > inputfile =3D> "blah", > input =3D> \$input2, > output =3D> \$output2 > }); > =09 > Which on my machine outputs: > =09 > $VAR1 =3D [ > { > 'hello' =3D> 42 > } > ]; > =09 > Surely this shouldn't happen? > =09 > --=20 > Michael Stevens > Dianomi Ltd > 18 Buckingham Gate > London SW1E 6LB > =09 > Tel: 020 7802 5530 > Fax: 020 7630 7356 > www.dianomi.com =20 > =09 > The information in this message and any attachment is=20 > intended for the=20 > addressee and is confidential and may be subject to=20 > legal privilege.=20 > Dianomi Ltd, Registered Office: One America Square,=20 > Crosswall, London.=20 > EC3N 2SG. Registered in England and Wales with Company=20 > Registration=20 > Number 4513809. VAT registration number: 809754988 > =09 > =09 > --------------------------------------------------------------------- > To unsubscribe, e-mail:=20 > embperl-unsubscribe@perl.apache.org=20 > =20 > For additional commands, e-mail:=20 > embperl-help@perl.apache.org =20 > =09 >=20 > =20 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 > =09 >=20 >=20 >=20 --------------------------------------------------------------------- To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org For additional commands, e-mail: embperl-help@perl.apache.org