perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gerald Richter - ECOS <>
Subject FW: How does [! sub() !] work ?
Date Thu, 06 May 2010 14:45:08 GMT

-----Original Message-----
From: Ed Grimm [] 
Sent: Thursday, May 06, 2010 1:50 PM
To: Jean-Christophe Boggio;
Subject: Re: How does [! sub() !] work ?

While Gerald's suggestion is the best one for your specific example, there could be other
issues you're having that could benefit from further enlightenment.

[! !] blocks do not declare a lexical scope.  You're running into at least two issues:

1. At the end of page processing, all the private namespace variables are cleaned up, so $req
isn't even around for routines in subs.epl after the initial load.  As such, I find it convinent
to put all of my global constants in their own namespace.  One can disable this cleanup, but
that opens you up to data bleeds and semi-controlled memory bloat.

2. These blocks are only processed on the initial load, so $req would be invalid on the subsequent
requests anyway.


----- Original Message -----
From: Jean-Christophe Boggio []
Sent: 05/06/2010 03:41 AM ZE2
To: "" <>
Subject: How does [! sub() !] work ?


I want to define a few subs used everywhere on my site. So I wrote :


$req = shift;

sub test {
	print OUT "test";

$subs = Execute({object => "$ENV{DOCUMENT_ROOT}/lib/subs.epl"});

This works fine but I can't get the values in $req from subs.epl and
I need my $req->{dbh}...

Any clue ? Thanks for your help,

Jean-Christophe Boggio                       -o)                       /\\
Independant Consultant and Developer        _\_V

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message