Re: <Perl>...</Perl> and startup.pl equivalent?

[prev] [thread] [next] [Date index for 2004/12/13]

From: Philippe M. Chiasson
Subject: Re: <Perl>...</Perl> and startup.pl equivalent?
Date: 23:42 on 13 Dec 2004
--------------enig96876AC896CB3F6DF02FA098
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

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

--------------enig96876AC896CB3F6DF02FA098
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBvij0yzKhB4jDpaURAnyeAKCLu+r4lP5SkkxJSQtxRDZMtyarJACdFZ5U
R3FwY4UW0SYA3E0etUuDHgg=
=oJNN
-----END PGP SIGNATURE-----

--------------enig96876AC896CB3F6DF02FA098--

(message missing)

Re: <Perl>...</Perl> and startup.pl equivalent?
Martin Moss 14:51 on 13 Dec 2004

Re: <Perl>...</Perl> and startup.pl equivalent?
Stas Bekman 23:41 on 13 Dec 2004

Re: <Perl>...</Perl> and startup.pl equivalent?
Stas Bekman 23:53 on 13 Dec 2004

Re: <Perl>...</Perl> and startup.pl equivalent?
Stas Bekman 00:29 on 14 Dec 2004

Re: <Perl>...</Perl> and startup.pl equivalent?
Stas Bekman 16:54 on 13 Dec 2004

Re: <Perl>...</Perl> and startup.pl equivalent?
Stas Bekman 23:31 on 13 Dec 2004

Re: <Perl>...</Perl> and startup.pl equivalent?
Philippe M. Chiasson 23:42 on 13 Dec 2004

Re: <Perl>...</Perl> and startup.pl equivalent?
Stas Bekman 00:27 on 14 Dec 2004

Re: <Perl>...</Perl> and startup.pl equivalent?
Philippe M. Chiasson 21:12 on 14 Dec 2004

Re: <Perl>...</Perl> and startup.pl equivalent?
Stas Bekman 23:53 on 14 Dec 2004

Generated at 12:15 on 16 Jan 2005 by mariachi v0.52