Cool. To my (naiive i'm sure) eye this looks just like the behaviour of a brace-delimited
block in a chunk of mainline code, which is what I was hoping/expecting.


Some examples of good/bad/dangerous things to do in these <Perl></Perl> sections
would be very helpful though. I can imagine for instance that mucking around with
package declarations inside one could make life complicated.


Regards: Colin

Philippe M. Chiasson wrote:

Stas Bekman wrote:

colin_e wrote:

Good stuff. Thanks for such a quick and helpful reply Stas.

The piece in the docs that had me confused was in the document
"Apache::PerlSections - Default Handler for Perl sections"
(http://perl.apache.org/docs/2.0/api/Apache/PerlSections.html#C__Apache__PerlSections__Save_).



This says:

> By default, the namespace in which |<Perl >| sections are evaluated is cleared
> after each block closes. By setting it to a true value, the content of those
> namespaces will be preserved and will be available for inspection by modules
> like |Apache::Status <http://perl.apache.org/docs/2.0/api/Apache/Status.html>|.


My grasp of perl is limited, "clearing a namespace" sounds to me like something goes
away. At this point i'm not entirely clear what, but i'm glad I have an answer to work
with.


Good question. Philippe wrote this part. Philippe, could you please expand that section with some examples explaining what's exactly happening? I agree that it's quite vague and I'm not sure what did you mean there myself.


It means that if in a <Perl> section you do something like :

<Perl>
$foo = "bar";
$Some::Global::var = 123;
Something->init($foo);
</Perl>

That once this code has been run, $foo goes away. As with the example of using
'use lib' to push tings into @INC, that's pefectly safe. Only the code (and vars)
local to the block of <Perl> gets flushed. $Some::Global::var would survive, for
instance.


--------------------------------------------------------------------------------

Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5



-- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Reply via email to