You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Michael Stevens <mi...@dianomi.com> on 2010/07/20 16:10:37 UTC
@param seems to be shared between Execute calls
Hi.
We're seeing an odd bug where @param seems to be shared between Execute
calls in the same process. The following code is a test case for this:
#!/usr/bin/perl -w
use strict;
use Embperl;
my $output1;
my $input = '[- $param[0]->{hello} = 42; -]';
Embperl::Execute({
inputfile => "blah",
input => \$input,
output => \$output1,
});
my $output2;
my $input2 = '[- use Data::Dumper; print Dumper(\@param); -]';
Embperl::Execute({
inputfile => "blah",
input => \$input2,
output => \$output2
});
Which on my machine outputs:
$VAR1 = [
{
'hello' => 42
}
];
Surely this shouldn't happen?
--
Michael Stevens
Dianomi Ltd
18 Buckingham Gate
London SW1E 6LB
Tel: 020 7802 5530
Fax: 020 7630 7356
www.dianomi.com
The information in this message and any attachment is intended for the
addressee and is confidential and may be subject to legal privilege.
Dianomi Ltd, Registered Office: One America Square, Crosswall, London.
EC3N 2SG. Registered in England and Wales with Company Registration
Number 4513809. VAT registration number: 809754988
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: @param seems to be shared between Execute calls
Posted by Michael Smith <sm...@gmail.com>.
Thank you Gerald and Andrew - that's most helpful and much appreciated
Michael
On Mon, Jul 26, 2010 at 9:06 AM, Gerald Richter - ECOS <
gerald.richter@ecos.de> wrote:
> Hi Michael,
>
>
>
> one way of figuring out if it was called through Execute is to use the
> caller funtction of Perl.
>
>
>
> The other one you can try it to use sub_req:
>
>
>
> sub_req
>
> top <http://www.ecos.de/embperl/pod/doc/Config.-page-4-.htm#top>
>
>
>
> [image: http://www.ecos.de/embperl/images/but.gif]
>
> Method:
>
>
>
> $component -> sub_req *[read only]*
>
> [image: http://www.ecos.de/embperl/images/transp.gif]
>
> [image: http://www.ecos.de/embperl/images/but.gif]
>
> Since:
>
>
>
> 2.0b6
>
> [image: http://www.ecos.de/embperl/images/transp.gif]
>
> True is this is not the outermost Embperl component, i.e. this component is
> called from within another component.
>
>
>
> Gerald
>
>
>
>
>
>
>
> *From:* Michael Smith [mailto:smithm@gmail.com]
> *Sent:* Friday, July 23, 2010 12:25 AM
> *To:* Gerald Richter - ECOS
> *Cc:* embperl@perl.apache.org; Michael Stevens;
> cabell.demarcellus@dianomi.com; Michael Smith
>
> *Subject:* Re: @param seems to be shared between Execute calls
>
>
>
> Thanks Gerald,
>
>
>
> That's good to know for the future. Is there a way to know if the code has
> been called through Execute? I am actually using the same code both
> directly and via Execute.
>
>
>
> Michael
>
> On Wed, Jul 21, 2010 at 10:19 AM, Gerald Richter - ECOS <
> gerald.richter@ecos.de> wrote:
>
> Hi Michael,
>
>
>
> @param is only intented to be used to pass parameters to Execute. Setting
> it directly might work or might not…
>
>
>
> If you want to share data inside a request use
>
>
>
> $epreq -> {test} = 1 ;
>
>
>
> The hash of $epreq is not used by Embperl itself, so you are free to use it
> and it exists exactly for the live time of one Apache request
>
>
>
> Gerald
>
>
>
>
>
>
>
> *From:* Michael Smith [mailto:smithm@gmail.com]
> *Sent:* Wednesday, July 21, 2010 11:05 AM
>
>
> *To:* embperl@perl.apache.org
>
> *Cc:* Michael Stevens; cabell.demarcellus@dianomi.com; Michael Smith
> *Subject:* Re: @param seems to be shared between Execute calls
>
>
>
> My problem is slightly different - though possibly a manifestation of the
> same thing. I find that param isn't cleaned up between requests.
>
>
>
> I have two epl files:
>
>
>
> set.epl:
>
> [- $param[0]->{'test'} = 1 -]
>
>
>
> get.epl
>
> [+ Dumper(@param) +]
>
>
>
> I find that the data from set.epl turns up when I make a subsequent request
> for get.epl (in practice it's a bit more random than that if one is running
> multiple processes, so I make a few requests for set.epl and then a few for
> get.epl)
>
>
>
> This only seems to be relevant if I reference param in the epl file I am
> calling directly. If I reference it in epl files which are loaded in by
> Execute, then they do appear to get cleaned up.
>
>
>
> Michael
>
>
>
>
>
> On Tue, Jul 20, 2010 at 10:20 PM, Ed Grimm <ed...@raytheon.com> wrote:
>
> Note that, under Apache, the cleanup code happens at the end of each
> request - each of which could have dozens of Execute calls, between which it
> is very definitely NOT called.
>
> I have not used Embperl much from within server scripts, but in my limited
> use there, I've never seen the cleanup code fire. I suspect each script is
> considered 'a request' for the purposes of the cleanup code (well, as far as
> docs are concerned. I don't know if the code actually fires on END.)
>
> --
> Ed Grimm
> Identity Services
>
> From:
>
> Michael Stevens <mi...@dianomi.com>
>
> To:
>
> embperl@perl.apache.org
>
> Cc:
>
> Michael Smith <mi...@dianomi.com>, cabell.demarcellus@dianomi.com
>
> Date:
>
> 07/20/2010 10:12 AM
>
> Subject:
>
> @param seems to be shared between Execute calls
>
>
> ------------------------------
>
>
>
>
> Hi.
>
> We're seeing an odd bug where @param seems to be shared between Execute
> calls in the same process. The following code is a test case for this:
>
> #!/usr/bin/perl -w
>
> use strict;
> use Embperl;
>
> my $output1;
>
> my $input = '[- $param[0]->{hello} = 42; -]';
>
> Embperl::Execute({
> inputfile => "blah",
> input => \$input,
> output => \$output1,
> });
>
> my $output2;
> my $input2 = '[- use Data::Dumper; print Dumper(\@param); -]';
>
> Embperl::Execute({
> inputfile => "blah",
> input => \$input2,
> output => \$output2
> });
>
> Which on my machine outputs:
>
> $VAR1 = [
> {
> 'hello' => 42
> }
> ];
>
> Surely this shouldn't happen?
>
> --
> Michael Stevens
> Dianomi Ltd
> 18 Buckingham Gate
> London SW1E 6LB
>
> Tel: 020 7802 5530
> Fax: 020 7630 7356
> www.dianomi.com
>
> The information in this message and any attachment is intended for the
> addressee and is confidential and may be subject to legal privilege.
> Dianomi Ltd, Registered Office: One America Square, Crosswall, London.
> EC3N 2SG. Registered in England and Wales with Company Registration
> Number 4513809. VAT registration number: 809754988
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
>
>
>
>
>
RE: @param seems to be shared between Execute calls
Posted by Gerald Richter - ECOS <ge...@ecos.de>.
Hi Michael,
one way of figuring out if it was called through Execute is to use the caller funtction of Perl.
The other one you can try it to use sub_req:
sub_req
top
Method:
$component -> sub_req [read only]
Since:
2.0b6
True is this is not the outermost Embperl component, i.e. this component is called from within another component.
Gerald
From: Michael Smith [mailto:smithm@gmail.com]
Sent: Friday, July 23, 2010 12:25 AM
To: Gerald Richter - ECOS
Cc: embperl@perl.apache.org; Michael Stevens; cabell.demarcellus@dianomi.com; Michael Smith
Subject: Re: @param seems to be shared between Execute calls
Thanks Gerald,
That's good to know for the future. Is there a way to know if the code has been called through Execute? I am actually using the same code both directly and via Execute.
Michael
On Wed, Jul 21, 2010 at 10:19 AM, Gerald Richter - ECOS <ge...@ecos.de> wrote:
Hi Michael,
@param is only intented to be used to pass parameters to Execute. Setting it directly might work or might not…
If you want to share data inside a request use
$epreq -> {test} = 1 ;
The hash of $epreq is not used by Embperl itself, so you are free to use it and it exists exactly for the live time of one Apache request
Gerald
From: Michael Smith [mailto:smithm@gmail.com]
Sent: Wednesday, July 21, 2010 11:05 AM
To: embperl@perl.apache.org
Cc: Michael Stevens; cabell.demarcellus@dianomi.com; Michael Smith
Subject: Re: @param seems to be shared between Execute calls
My problem is slightly different - though possibly a manifestation of the same thing. I find that param isn't cleaned up between requests.
I have two epl files:
set.epl:
[- $param[0]->{'test'} = 1 -]
get.epl
[+ Dumper(@param) +]
I find that the data from set.epl turns up when I make a subsequent request for get.epl (in practice it's a bit more random than that if one is running multiple processes, so I make a few requests for set.epl and then a few for get.epl)
This only seems to be relevant if I reference param in the epl file I am calling directly. If I reference it in epl files which are loaded in by Execute, then they do appear to get cleaned up.
Michael
On Tue, Jul 20, 2010 at 10:20 PM, Ed Grimm <ed...@raytheon.com> wrote:
Note that, under Apache, the cleanup code happens at the end of each request - each of which could have dozens of Execute calls, between which it is very definitely NOT called.
I have not used Embperl much from within server scripts, but in my limited use there, I've never seen the cleanup code fire. I suspect each script is considered 'a request' for the purposes of the cleanup code (well, as far as docs are concerned. I don't know if the code actually fires on END.)
--
Ed Grimm
Identity Services
From:
Michael Stevens <mi...@dianomi.com>
To:
embperl@perl.apache.org
Cc:
Michael Smith <mi...@dianomi.com>, cabell.demarcellus@dianomi.com
Date:
07/20/2010 10:12 AM
Subject:
@param seems to be shared between Execute calls
Hi.
We're seeing an odd bug where @param seems to be shared between Execute
calls in the same process. The following code is a test case for this:
#!/usr/bin/perl -w
use strict;
use Embperl;
my $output1;
my $input = '[- $param[0]->{hello} = 42; -]';
Embperl::Execute({
inputfile => "blah",
input => \$input,
output => \$output1,
});
my $output2;
my $input2 = '[- use Data::Dumper; print Dumper(\@param); -]';
Embperl::Execute({
inputfile => "blah",
input => \$input2,
output => \$output2
});
Which on my machine outputs:
$VAR1 = [
{
'hello' => 42
}
];
Surely this shouldn't happen?
--
Michael Stevens
Dianomi Ltd
18 Buckingham Gate
London SW1E 6LB
Tel: 020 7802 5530
Fax: 020 7630 7356
www.dianomi.com
The information in this message and any attachment is intended for the
addressee and is confidential and may be subject to legal privilege.
Dianomi Ltd, Registered Office: One America Square, Crosswall, London.
EC3N 2SG. Registered in England and Wales with Company Registration
Number 4513809. VAT registration number: 809754988
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
RE: @param seems to be shared between Execute calls
Posted by Andrew O'Brien <an...@oriel.com.au>.
Hi Michael,
> Thanks for the email. I'm actually using @param to return
> data (as well as the HTML) to the epl script which is calling
> 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 = {};
my $output1;
my $input = '[- $param[0]->{hello} = 42; -]';
Embperl::Execute({ inputfile => "blah",
input => \$input,
output => \$output1,
param => [ $data ],
});
print "Execute of file 1, data is currently set to:\n" . Dumper($data);
my $output2;
my $input2 = 'Hello! I was executed with the following arguments: [+ do
{ use Data::Dumper; Dumper(\@param); } +]';
Embperl::Execute({ inputfile => "blah",
input => \$input2,
output => \$output2,
param => [ $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 = {
'hello' => 42
};
Execute of file 2, data is currently set to:
$VAR1 = {
'hello' => 42
};
Output of Execute() call:
Hello! I was executed with the following arguments: $VAR1 = [
{
'hello' => 42
}
];
> On Fri, Jul 23, 2010 at 4:38 AM, Ed Grimm
> <ed...@raytheon.com> wrote:
>
>
> If your Embperl pages are calling regular perl module
> code that uses @param, couldn't you just pass it from your
> Embperl page as a parameter, rather than using it as a global?
>
> Alternatively, if you are talking about code within an
> Embperl page, how do you process those without going through
> Execute? Note that the standard apache handler calls
> Execute, last I checked. I seem to recall there's a few
> other methods to run Embperl pages - but ultimately, they all
> call Execute. Disclaimer: I haven't looked in a while, and
> it's late, and I'm tired.
>
> --
> Ed Grimm
> Identity Services
>
>
>
> From: Michael Smith <sm...@gmail.com>
> To: Gerald Richter - ECOS <ge...@ecos.de>
> Cc: embperl@perl.apache.org, Michael Stevens
> <mi...@dianomi.com>,
> cabell.demarcellus@dianomi.com, Michael Smith
> <mi...@dianomi.com>
> Date: 07/22/2010 06:25 PM
> Subject: Re: @param seems to be shared between Execute calls
>
> ________________________________
>
>
>
>
> Thanks Gerald,
>
> That's good to know for the future. Is there a way to
> know if the code has been called through Execute? I am
> actually using the same code both directly and via Execute.
>
> Michael
>
> On Wed, Jul 21, 2010 at 10:19 AM, Gerald Richter - ECOS
> <gerald.richter@ecos.de <ma...@ecos.de> > wrote:
> Hi Michael,
>
>
>
> @param is only intented to be used to pass parameters
> to Execute. Setting it directly might work or might not...
>
>
>
> If you want to share data inside a request use
>
>
>
> $epreq -> {test} = 1 ;
>
>
>
> The hash of $epreq is not used by Embperl itself, so
> you are free to use it and it exists exactly for the live
> time of one Apache request
>
>
>
> Gerald
>
>
>
>
>
>
>
> From: Michael Smith [mailto:smithm@gmail.com
> <ma...@gmail.com> ]
> Sent: Wednesday, July 21, 2010 11:05 AM
>
>
> To: embperl@perl.apache.org <ma...@perl.apache.org>
> Cc: Michael Stevens; cabell.demarcellus@dianomi.com
> <ma...@dianomi.com> ; Michael Smith
> Subject: Re: @param seems to be shared between Execute calls
>
>
>
> My problem is slightly different - though possibly a
> manifestation of the same thing. I find that param isn't
> cleaned up between requests.
>
>
>
> I have two epl files:
>
>
>
> set.epl:
>
> [- $param[0]->{'test'} = 1 -]
>
>
>
> get.epl
>
> [+ Dumper(@param) +]
>
>
>
> I find that the data from set.epl turns up when I make
> a subsequent request for get.epl (in practice it's a bit more
> random than that if one is running multiple processes, so I
> make a few requests for set.epl and then a few for get.epl)
>
>
>
> This only seems to be relevant if I reference param in
> the epl file I am calling directly. If I reference it in epl
> files which are loaded in by Execute, then they do appear to
> get cleaned up.
>
>
>
> Michael
>
>
>
>
>
> On Tue, Jul 20, 2010 at 10:20 PM, Ed Grimm
> <ed_grimm@raytheon.com <ma...@raytheon.com> > wrote:
>
> Note that, under Apache, the cleanup code happens at
> the end of each request - each of which could have dozens of
> Execute calls, between which it is very definitely NOT called.
>
> I have not used Embperl much from within server
> scripts, but in my limited use there, I've never seen the
> cleanup code fire. I suspect each script is considered 'a
> request' for the purposes of the cleanup code (well, as far
> as docs are concerned. I don't know if the code actually
> fires on END.)
>
> --
> Ed Grimm
> Identity Services
>
>
>
>
> From: Michael Stevens <michael.stevens@dianomi.com
> <ma...@dianomi.com> >
> To: embperl@perl.apache.org <ma...@perl.apache.org>
> Cc: Michael Smith <michael.smith@dianomi.com
> <ma...@dianomi.com> >,
> cabell.demarcellus@dianomi.com
> <ma...@dianomi.com>
> Date: 07/20/2010 10:12 AM
> Subject: @param seems to be shared between Execute calls
>
>
>
>
>
> ________________________________
>
>
>
>
>
>
> Hi.
>
> We're seeing an odd bug where @param seems to be shared
> between Execute
> calls in the same process. The following code is a test
> case for this:
>
> #!/usr/bin/perl -w
>
> use strict;
> use Embperl;
>
> my $output1;
>
> my $input = '[- $param[0]->{hello} = 42; -]';
>
> Embperl::Execute({
> inputfile => "blah",
> input => \$input,
> output => \$output1,
> });
>
> my $output2;
> my $input2 = '[- use Data::Dumper; print Dumper(\@param); -]';
>
> Embperl::Execute({
> inputfile => "blah",
> input => \$input2,
> output => \$output2
> });
>
> Which on my machine outputs:
>
> $VAR1 = [
> {
> 'hello' => 42
> }
> ];
>
> Surely this shouldn't happen?
>
> --
> Michael Stevens
> Dianomi Ltd
> 18 Buckingham Gate
> London SW1E 6LB
>
> Tel: 020 7802 5530
> Fax: 020 7630 7356
> www.dianomi.com <http://www.dianomi.com/>
>
> The information in this message and any attachment is
> intended for the
> addressee and is confidential and may be subject to
> legal privilege.
> Dianomi Ltd, Registered Office: One America Square,
> Crosswall, London.
> EC3N 2SG. Registered in England and Wales with Company
> Registration
> Number 4513809. VAT registration number: 809754988
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> embperl-unsubscribe@perl.apache.org
> <ma...@perl.apache.org>
> For additional commands, e-mail:
> embperl-help@perl.apache.org <ma...@perl.apache.org>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: @param seems to be shared between Execute calls
Posted by Michael Smith <sm...@gmail.com>.
Hi Ed,
Thanks for the email. I'm actually using @param to return data (as well as
the HTML) to the epl script which is calling another one via Execute.
Perhaps there's a better way.
Michael
On Fri, Jul 23, 2010 at 4:38 AM, Ed Grimm <ed...@raytheon.com> wrote:
> If your Embperl pages are calling regular perl module code that uses
> @param, couldn't you just pass it from your Embperl page as a parameter,
> rather than using it as a global?
>
> Alternatively, if you are talking about code within an Embperl page, how do
> you process those without going through Execute? Note that the standard
> apache handler calls Execute, last I checked. I seem to recall there's a
> few other methods to run Embperl pages - but ultimately, they all call
> Execute. Disclaimer: I haven't looked in a while, and it's late, and I'm
> tired.
>
> --
> Ed Grimm
> Identity Services
>
>
> From: Michael Smith <sm...@gmail.com> To:
> Gerald Richter - ECOS <ge...@ecos.de>
> Cc: embperl@perl.apache.org, Michael Stevens <mi...@dianomi.com>,
> cabell.demarcellus@dianomi.com, Michael Smith <mi...@dianomi.com>
> Date: 07/22/2010 06:25 PM Subject: Re: @param seems to be shared between
> Execute calls
> ------------------------------
>
>
>
> Thanks Gerald,
>
> That's good to know for the future. Is there a way to know if the code has
> been called through Execute? I am actually using the same code both
> directly and via Execute.
>
> Michael
>
> On Wed, Jul 21, 2010 at 10:19 AM, Gerald Richter - ECOS <*
> gerald.richter@ecos.de* <ge...@ecos.de>> wrote:
> Hi Michael,
>
>
>
> @param is only intented to be used to pass parameters to Execute. Setting
> it directly might work or might not…
>
>
>
> If you want to share data inside a request use
>
>
>
> $epreq -> {test} = 1 ;
>
>
>
> The hash of $epreq is not used by Embperl itself, so you are free to use it
> and it exists exactly for the live time of one Apache request
>
>
>
> Gerald
>
>
>
>
>
>
>
> *From:* Michael Smith [mailto:*smithm@gmail.com* <sm...@gmail.com>] *
> Sent:* Wednesday, July 21, 2010 11:05 AM
>
> *
> To:* *embperl@perl.apache.org* <em...@perl.apache.org>
> *Cc:* Michael Stevens; *cabell.demarcellus@dianomi.com*<ca...@dianomi.com>;
> Michael Smith*
> Subject:* Re: @param seems to be shared between Execute calls
>
>
>
> My problem is slightly different - though possibly a manifestation of the
> same thing. I find that param isn't cleaned up between requests.
>
>
>
> I have two epl files:
>
>
>
> set.epl:
>
> [- $param[0]->{'test'} = 1 -]
>
>
>
> get.epl
>
> [+ Dumper(@param) +]
>
>
>
> I find that the data from set.epl turns up when I make a subsequent request
> for get.epl (in practice it's a bit more random than that if one is running
> multiple processes, so I make a few requests for set.epl and then a few for
> get.epl)
>
>
>
> This only seems to be relevant if I reference param in the epl file I am
> calling directly. If I reference it in epl files which are loaded in by
> Execute, then they do appear to get cleaned up.
>
>
>
> Michael
>
>
>
>
>
> On Tue, Jul 20, 2010 at 10:20 PM, Ed Grimm <*e...@raytheon.com>>
> wrote:
>
> Note that, under Apache, the cleanup code happens at the end of each
> request - each of which could have dozens of Execute calls, between which it
> is very definitely NOT called.
>
> I have not used Embperl much from within server scripts, but in my limited
> use there, I've never seen the cleanup code fire. I suspect each script is
> considered 'a request' for the purposes of the cleanup code (well, as far as
> docs are concerned. I don't know if the code actually fires on END.)
>
> --
> Ed Grimm
> Identity Services
>
> From: Michael Stevens <*m...@dianomi.com>
> > To: *embperl@perl.apache.org* <em...@perl.apache.org> Cc: Michael
> Smith <*michael.smith@dianomi.com* <mi...@dianomi.com>>, *
> cabell.demarcellus@dianomi.com* <ca...@dianomi.com> Date: 07/20/2010
> 10:12 AM Subject: @param seems to be shared between Execute calls
>
>
>
> ------------------------------
>
>
>
>
> Hi.
>
> We're seeing an odd bug where @param seems to be shared between Execute
> calls in the same process. The following code is a test case for this:
>
> #!/usr/bin/perl -w
>
> use strict;
> use Embperl;
>
> my $output1;
>
> my $input = '[- $param[0]->{hello} = 42; -]';
>
> Embperl::Execute({
> inputfile => "blah",
> input => \$input,
> output => \$output1,
> });
>
> my $output2;
> my $input2 = '[- use Data::Dumper; print Dumper(\@param); -]';
>
> Embperl::Execute({
> inputfile => "blah",
> input => \$input2,
> output => \$output2
> });
>
> Which on my machine outputs:
>
> $VAR1 = [
> {
> 'hello' => 42
> }
> ];
>
> Surely this shouldn't happen?
>
> --
> Michael Stevens
> Dianomi Ltd
> 18 Buckingham Gate
> London SW1E 6LB
>
> Tel: 020 7802 5530
> Fax: 020 7630 7356*
> **www.dianomi.com* <http://www.dianomi.com/>
>
> The information in this message and any attachment is intended for the
> addressee and is confidential and may be subject to legal privilege.
> Dianomi Ltd, Registered Office: One America Square, Crosswall, London.
> EC3N 2SG. Registered in England and Wales with Company Registration
> Number 4513809. VAT registration number: 809754988
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: *embperl-unsubscribe@perl.apache.org*<em...@perl.apache.org>
> For additional commands, e-mail: *embperl-help@perl.apache.org*<em...@perl.apache.org>
>
>
>
>
Re: @param seems to be shared between Execute calls
Posted by Michael Smith <sm...@gmail.com>.
Thanks Gerald,
That's good to know for the future. Is there a way to know if the code has
been called through Execute? I am actually using the same code both
directly and via Execute.
Michael
On Wed, Jul 21, 2010 at 10:19 AM, Gerald Richter - ECOS <
gerald.richter@ecos.de> wrote:
> Hi Michael,
>
>
>
> @param is only intented to be used to pass parameters to Execute. Setting
> it directly might work or might not…
>
>
>
> If you want to share data inside a request use
>
>
>
> $epreq -> {test} = 1 ;
>
>
>
> The hash of $epreq is not used by Embperl itself, so you are free to use it
> and it exists exactly for the live time of one Apache request
>
>
>
> Gerald
>
>
>
>
>
>
>
> *From:* Michael Smith [mailto:smithm@gmail.com]
> *Sent:* Wednesday, July 21, 2010 11:05 AM
>
> *To:* embperl@perl.apache.org
> *Cc:* Michael Stevens; cabell.demarcellus@dianomi.com; Michael Smith
> *Subject:* Re: @param seems to be shared between Execute calls
>
>
>
> My problem is slightly different - though possibly a manifestation of the
> same thing. I find that param isn't cleaned up between requests.
>
>
>
> I have two epl files:
>
>
>
> set.epl:
>
> [- $param[0]->{'test'} = 1 -]
>
>
>
> get.epl
>
> [+ Dumper(@param) +]
>
>
>
> I find that the data from set.epl turns up when I make a subsequent request
> for get.epl (in practice it's a bit more random than that if one is running
> multiple processes, so I make a few requests for set.epl and then a few for
> get.epl)
>
>
>
> This only seems to be relevant if I reference param in the epl file I am
> calling directly. If I reference it in epl files which are loaded in by
> Execute, then they do appear to get cleaned up.
>
>
>
> Michael
>
>
>
>
>
> On Tue, Jul 20, 2010 at 10:20 PM, Ed Grimm <ed...@raytheon.com> wrote:
>
> Note that, under Apache, the cleanup code happens at the end of each
> request - each of which could have dozens of Execute calls, between which it
> is very definitely NOT called.
>
> I have not used Embperl much from within server scripts, but in my limited
> use there, I've never seen the cleanup code fire. I suspect each script is
> considered 'a request' for the purposes of the cleanup code (well, as far as
> docs are concerned. I don't know if the code actually fires on END.)
>
> --
> Ed Grimm
> Identity Services
>
> From:
>
> Michael Stevens <mi...@dianomi.com>
>
> To:
>
> embperl@perl.apache.org
>
> Cc:
>
> Michael Smith <mi...@dianomi.com>, cabell.demarcellus@dianomi.com
>
> Date:
>
> 07/20/2010 10:12 AM
>
> Subject:
>
> @param seems to be shared between Execute calls
>
>
> ------------------------------
>
>
>
>
> Hi.
>
> We're seeing an odd bug where @param seems to be shared between Execute
> calls in the same process. The following code is a test case for this:
>
> #!/usr/bin/perl -w
>
> use strict;
> use Embperl;
>
> my $output1;
>
> my $input = '[- $param[0]->{hello} = 42; -]';
>
> Embperl::Execute({
> inputfile => "blah",
> input => \$input,
> output => \$output1,
> });
>
> my $output2;
> my $input2 = '[- use Data::Dumper; print Dumper(\@param); -]';
>
> Embperl::Execute({
> inputfile => "blah",
> input => \$input2,
> output => \$output2
> });
>
> Which on my machine outputs:
>
> $VAR1 = [
> {
> 'hello' => 42
> }
> ];
>
> Surely this shouldn't happen?
>
> --
> Michael Stevens
> Dianomi Ltd
> 18 Buckingham Gate
> London SW1E 6LB
>
> Tel: 020 7802 5530
> Fax: 020 7630 7356
> www.dianomi.com
>
> The information in this message and any attachment is intended for the
> addressee and is confidential and may be subject to legal privilege.
> Dianomi Ltd, Registered Office: One America Square, Crosswall, London.
> EC3N 2SG. Registered in England and Wales with Company Registration
> Number 4513809. VAT registration number: 809754988
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
>
>
>
RE: @param seems to be shared between Execute calls
Posted by Gerald Richter - ECOS <ge...@ecos.de>.
Hi Michael,
@param is only intented to be used to pass parameters to Execute. Setting it directly might work or might not…
If you want to share data inside a request use
$epreq -> {test} = 1 ;
The hash of $epreq is not used by Embperl itself, so you are free to use it and it exists exactly for the live time of one Apache request
Gerald
From: Michael Smith [mailto:smithm@gmail.com]
Sent: Wednesday, July 21, 2010 11:05 AM
To: embperl@perl.apache.org
Cc: Michael Stevens; cabell.demarcellus@dianomi.com; Michael Smith
Subject: Re: @param seems to be shared between Execute calls
My problem is slightly different - though possibly a manifestation of the same thing. I find that param isn't cleaned up between requests.
I have two epl files:
set.epl:
[- $param[0]->{'test'} = 1 -]
get.epl
[+ Dumper(@param) +]
I find that the data from set.epl turns up when I make a subsequent request for get.epl (in practice it's a bit more random than that if one is running multiple processes, so I make a few requests for set.epl and then a few for get.epl)
This only seems to be relevant if I reference param in the epl file I am calling directly. If I reference it in epl files which are loaded in by Execute, then they do appear to get cleaned up.
Michael
On Tue, Jul 20, 2010 at 10:20 PM, Ed Grimm <ed...@raytheon.com> wrote:
Note that, under Apache, the cleanup code happens at the end of each request - each of which could have dozens of Execute calls, between which it is very definitely NOT called.
I have not used Embperl much from within server scripts, but in my limited use there, I've never seen the cleanup code fire. I suspect each script is considered 'a request' for the purposes of the cleanup code (well, as far as docs are concerned. I don't know if the code actually fires on END.)
--
Ed Grimm
Identity Services
From:
Michael Stevens <mi...@dianomi.com>
To:
embperl@perl.apache.org
Cc:
Michael Smith <mi...@dianomi.com>, cabell.demarcellus@dianomi.com
Date:
07/20/2010 10:12 AM
Subject:
@param seems to be shared between Execute calls
Hi.
We're seeing an odd bug where @param seems to be shared between Execute
calls in the same process. The following code is a test case for this:
#!/usr/bin/perl -w
use strict;
use Embperl;
my $output1;
my $input = '[- $param[0]->{hello} = 42; -]';
Embperl::Execute({
inputfile => "blah",
input => \$input,
output => \$output1,
});
my $output2;
my $input2 = '[- use Data::Dumper; print Dumper(\@param); -]';
Embperl::Execute({
inputfile => "blah",
input => \$input2,
output => \$output2
});
Which on my machine outputs:
$VAR1 = [
{
'hello' => 42
}
];
Surely this shouldn't happen?
--
Michael Stevens
Dianomi Ltd
18 Buckingham Gate
London SW1E 6LB
Tel: 020 7802 5530
Fax: 020 7630 7356
www.dianomi.com
The information in this message and any attachment is intended for the
addressee and is confidential and may be subject to legal privilege.
Dianomi Ltd, Registered Office: One America Square, Crosswall, London.
EC3N 2SG. Registered in England and Wales with Company Registration
Number 4513809. VAT registration number: 809754988
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
RE: @param seems to be shared between Execute calls
Posted by Gerald Richter - ECOS <ge...@ecos.de>.
@param is a special variable and you use it in an unsupported way (see my other mail).
Any other global should be cleaned up at the end of the request
Gerald
> -----Original Message-----
> From: Michael Stevens [mailto:michael.stevens@dianomi.com]
> Sent: Wednesday, July 21, 2010 12:46 PM
> To: Ed Grimm
> Cc: cabell.demarcellus@dianomi.com; embperl@perl.apache.org; Michael
> Smith
> Subject: Re: @param seems to be shared between Execute calls
>
> My actual problem is occuring under Apache, and what I'm expecting is
> for things to be cleaned up between requests, which isn't happening.
>
> But even this small test case is not the way I'd expect things to
> behave.
>
> On 20/07/10 22:20, Ed Grimm wrote:
> > Note that, under Apache, the cleanup code happens at the end of each
> > request - each of which could have dozens of Execute calls, between
> > which it is very definitely NOT called.
> >
> > I have not used Embperl much from within server scripts, but in my
> > limited use there, I've never seen the cleanup code fire. I suspect
> each
> > script is considered 'a request' for the purposes of the cleanup code
> > (well, as far as docs are concerned. I don't know if the code
> actually
> > fires on END.)
> >
> > --
> > Ed Grimm
> > Identity Services
> >
> >
> > From: Michael Stevens <mi...@dianomi.com>
> > To: embperl@perl.apache.org
> > Cc: Michael Smith <mi...@dianomi.com>,
> > cabell.demarcellus@dianomi.com
> > Date: 07/20/2010 10:12 AM
> > Subject: @param seems to be shared between Execute calls
> >
> >
> > ---------------------------------------------------------------------
> ---
> >
> >
> >
> > Hi.
> >
> > We're seeing an odd bug where @param seems to be shared between
> Execute
> > calls in the same process. The following code is a test case for
> this:
> >
> > #!/usr/bin/perl -w
> >
> > use strict;
> > use Embperl;
> >
> > my $output1;
> >
> > my $input = '[- $param[0]->{hello} = 42; -]';
> >
> > Embperl::Execute({
> > inputfile => "blah",
> > input => \$input,
> > output => \$output1,
> > });
> >
> > my $output2;
> > my $input2 = '[- use Data::Dumper; print Dumper(\@param); -]';
> >
> > Embperl::Execute({
> > inputfile => "blah",
> > input => \$input2,
> > output => \$output2
> > });
> >
> > Which on my machine outputs:
> >
> > $VAR1 = [
> > {
> > 'hello' => 42
> > }
> > ];
> >
> > Surely this shouldn't happen?
> >
> > --
> > Michael Stevens
> > Dianomi Ltd
> > 18 Buckingham Gate
> > London SW1E 6LB
> >
> > Tel: 020 7802 5530
> > Fax: 020 7630 7356
> > www.dianomi.com
> >
> > The information in this message and any attachment is intended for
> the
> > addressee and is confidential and may be subject to legal privilege.
> > Dianomi Ltd, Registered Office: One America Square, Crosswall,
> London.
> > EC3N 2SG. Registered in England and Wales with Company Registration
> > Number 4513809. VAT registration number: 809754988
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> > For additional commands, e-mail: embperl-help@perl.apache.org
> >
> >
>
>
> --
> Michael Stevens
> Dianomi Ltd
> 18 Buckingham Gate
> London SW1E 6LB
>
> Tel: 020 7802 5530
> Fax: 020 7630 7356
> www.dianomi.com
>
> The information in this message and any attachment is intended for the
> addressee and is confidential and may be subject to legal privilege.
> Dianomi Ltd, Registered Office: One America Square, Crosswall, London.
> EC3N 2SG. Registered in England and Wales with Company Registration
> Number 4513809. VAT registration number: 809754988
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: @param seems to be shared between Execute calls
Posted by Dirk Melchers <me...@nureg.de>.
Hi,
Am 21.07.2010 um 11:05 schrieb Michael Smith:
> My problem is slightly different - though possibly a manifestation of the same thing. I find that param isn't cleaned up between requests.
>
> I have two epl files:
>
> set.epl:
> [- $param[0]->{'test'} = 1 -]
>
> get.epl
> [+ Dumper(@param) +]
>
> I find that the data from set.epl turns up when I make a subsequent request for get.epl (in practice it's a bit more random than that if one is running multiple processes, so I make a few requests for set.epl and then a few for get.epl)
>
> This only seems to be relevant if I reference param in the epl file I am calling directly. If I reference it in epl files which are loaded in by Execute, then they do appear to get cleaned up.
I think, in "set.epl" you create a global variable "@param" and fill some values in it. Global variables are not cleaned up after the request, so "get.epl" will see this global var later, if you hit an apache process which ran "set.epl" before. This is also a good way to eat all memory of the apache processes.... :-(
I think, this would also work if you name it "$foo[0]...." - so there is no magic in "@param", if it is not used in an "Execute"-Call.
You may also take care of nested calls of epl-files: the @param is the same for all calls, so you might get some strange effects there...
With best regards
Dirk Melchers
/// IT/Software-Entwicklung ///
--
NUREG GmbH ///
Dorfäckerstraße 31 | 90427 Nürnberg | Germany
Tel. +49-911-32002-256 | Fax +49-911-32002-299
Mobil +49-172-9354670 | www.nureg.de
Nürnberg HRB 22653 | USt.ID DE 814 685 653
Geschäftsführer: Michael Schmidt, Stefan Boas
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: @param seems to be shared between Execute calls
Posted by Michael Smith <sm...@gmail.com>.
My problem is slightly different - though possibly a manifestation of the
same thing. I find that param isn't cleaned up between requests.
I have two epl files:
set.epl:
[- $param[0]->{'test'} = 1 -]
get.epl
[+ Dumper(@param) +]
I find that the data from set.epl turns up when I make a subsequent request
for get.epl (in practice it's a bit more random than that if one is running
multiple processes, so I make a few requests for set.epl and then a few for
get.epl)
This only seems to be relevant if I reference param in the epl file I am
calling directly. If I reference it in epl files which are loaded in by
Execute, then they do appear to get cleaned up.
Michael
On Tue, Jul 20, 2010 at 10:20 PM, Ed Grimm <ed...@raytheon.com> wrote:
> Note that, under Apache, the cleanup code happens at the end of each
> request - each of which could have dozens of Execute calls, between which it
> is very definitely NOT called.
>
> I have not used Embperl much from within server scripts, but in my limited
> use there, I've never seen the cleanup code fire. I suspect each script is
> considered 'a request' for the purposes of the cleanup code (well, as far as
> docs are concerned. I don't know if the code actually fires on END.)
>
> --
> Ed Grimm
> Identity Services
>
>
> From: Michael Stevens <mi...@dianomi.com> To:
> embperl@perl.apache.org Cc: Michael Smith <mi...@dianomi.com>,
> cabell.demarcellus@dianomi.com Date: 07/20/2010 10:12 AM Subject: @param
> seems to be shared between Execute calls
> ------------------------------
>
>
>
> Hi.
>
> We're seeing an odd bug where @param seems to be shared between Execute
> calls in the same process. The following code is a test case for this:
>
> #!/usr/bin/perl -w
>
> use strict;
> use Embperl;
>
> my $output1;
>
> my $input = '[- $param[0]->{hello} = 42; -]';
>
> Embperl::Execute({
> inputfile => "blah",
> input => \$input,
> output => \$output1,
> });
>
> my $output2;
> my $input2 = '[- use Data::Dumper; print Dumper(\@param); -]';
>
> Embperl::Execute({
> inputfile => "blah",
> input => \$input2,
> output => \$output2
> });
>
> Which on my machine outputs:
>
> $VAR1 = [
> {
> 'hello' => 42
> }
> ];
>
> Surely this shouldn't happen?
>
> --
> Michael Stevens
> Dianomi Ltd
> 18 Buckingham Gate
> London SW1E 6LB
>
> Tel: 020 7802 5530
> Fax: 020 7630 7356
> www.dianomi.com
>
> The information in this message and any attachment is intended for the
> addressee and is confidential and may be subject to legal privilege.
> Dianomi Ltd, Registered Office: One America Square, Crosswall, London.
> EC3N 2SG. Registered in England and Wales with Company Registration
> Number 4513809. VAT registration number: 809754988
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
>
>
>
Re: @param seems to be shared between Execute calls
Posted by Michael Stevens <mi...@dianomi.com>.
My actual problem is occuring under Apache, and what I'm expecting is
for things to be cleaned up between requests, which isn't happening.
But even this small test case is not the way I'd expect things to behave.
On 20/07/10 22:20, Ed Grimm wrote:
> Note that, under Apache, the cleanup code happens at the end of each
> request - each of which could have dozens of Execute calls, between
> which it is very definitely NOT called.
>
> I have not used Embperl much from within server scripts, but in my
> limited use there, I've never seen the cleanup code fire. I suspect each
> script is considered 'a request' for the purposes of the cleanup code
> (well, as far as docs are concerned. I don't know if the code actually
> fires on END.)
>
> --
> Ed Grimm
> Identity Services
>
>
> From: Michael Stevens <mi...@dianomi.com>
> To: embperl@perl.apache.org
> Cc: Michael Smith <mi...@dianomi.com>,
> cabell.demarcellus@dianomi.com
> Date: 07/20/2010 10:12 AM
> Subject: @param seems to be shared between Execute calls
>
>
> ------------------------------------------------------------------------
>
>
>
> Hi.
>
> We're seeing an odd bug where @param seems to be shared between Execute
> calls in the same process. The following code is a test case for this:
>
> #!/usr/bin/perl -w
>
> use strict;
> use Embperl;
>
> my $output1;
>
> my $input = '[- $param[0]->{hello} = 42; -]';
>
> Embperl::Execute({
> inputfile => "blah",
> input => \$input,
> output => \$output1,
> });
>
> my $output2;
> my $input2 = '[- use Data::Dumper; print Dumper(\@param); -]';
>
> Embperl::Execute({
> inputfile => "blah",
> input => \$input2,
> output => \$output2
> });
>
> Which on my machine outputs:
>
> $VAR1 = [
> {
> 'hello' => 42
> }
> ];
>
> Surely this shouldn't happen?
>
> --
> Michael Stevens
> Dianomi Ltd
> 18 Buckingham Gate
> London SW1E 6LB
>
> Tel: 020 7802 5530
> Fax: 020 7630 7356
> www.dianomi.com
>
> The information in this message and any attachment is intended for the
> addressee and is confidential and may be subject to legal privilege.
> Dianomi Ltd, Registered Office: One America Square, Crosswall, London.
> EC3N 2SG. Registered in England and Wales with Company Registration
> Number 4513809. VAT registration number: 809754988
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
>
>
--
Michael Stevens
Dianomi Ltd
18 Buckingham Gate
London SW1E 6LB
Tel: 020 7802 5530
Fax: 020 7630 7356
www.dianomi.com
The information in this message and any attachment is intended for the
addressee and is confidential and may be subject to legal privilege.
Dianomi Ltd, Registered Office: One America Square, Crosswall, London.
EC3N 2SG. Registered in England and Wales with Company Registration
Number 4513809. VAT registration number: 809754988
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: @param seems to be shared between Execute calls
Posted by Ed Grimm <ed...@raytheon.com>.
Note that, under Apache, the cleanup code happens at the end of each
request - each of which could have dozens of Execute calls, between which
it is very definitely NOT called.
I have not used Embperl much from within server scripts, but in my limited
use there, I've never seen the cleanup code fire. I suspect each script
is considered 'a request' for the purposes of the cleanup code (well, as
far as docs are concerned. I don't know if the code actually fires on
END.)
--
Ed Grimm
Identity Services
From:
Michael Stevens <mi...@dianomi.com>
To:
embperl@perl.apache.org
Cc:
Michael Smith <mi...@dianomi.com>, cabell.demarcellus@dianomi.com
Date:
07/20/2010 10:12 AM
Subject:
@param seems to be shared between Execute calls
Hi.
We're seeing an odd bug where @param seems to be shared between Execute
calls in the same process. The following code is a test case for this:
#!/usr/bin/perl -w
use strict;
use Embperl;
my $output1;
my $input = '[- $param[0]->{hello} = 42; -]';
Embperl::Execute({
inputfile => "blah",
input => \$input,
output => \$output1,
});
my $output2;
my $input2 = '[- use Data::Dumper; print Dumper(\@param); -]';
Embperl::Execute({
inputfile => "blah",
input => \$input2,
output => \$output2
});
Which on my machine outputs:
$VAR1 = [
{
'hello' => 42
}
];
Surely this shouldn't happen?
--
Michael Stevens
Dianomi Ltd
18 Buckingham Gate
London SW1E 6LB
Tel: 020 7802 5530
Fax: 020 7630 7356
www.dianomi.com
The information in this message and any attachment is intended for the
addressee and is confidential and may be subject to legal privilege.
Dianomi Ltd, Registered Office: One America Square, Crosswall, London.
EC3N 2SG. Registered in England and Wales with Company Registration
Number 4513809. VAT registration number: 809754988
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org