-----Original Message----- From: Ed Grimm [mailto:[email protected]] Sent: Thursday, May 06, 2010 1:50 PM To: Jean-Christophe Boggio; [email protected] 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. Ed ----- Original Message ----- From: Jean-Christophe Boggio [[email protected]] Sent: 05/06/2010 03:41 AM ZE2 To: "[email protected]" <[email protected]> Subject: How does [! sub() !] work ? Hello, I want to define a few subs used everywhere on my site. So I wrote : lib/subs.epl: [! $req = shift; sub test { print OUT "test"; } !] test.html: [- $subs = Execute({object => "$ENV{DOCUMENT_ROOT}/lib/subs.epl"}); $subs->test; -] 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) [email protected] /\\ Independant Consultant and Developer _\_V --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
