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

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

From: colin_e
Subject: Re: <Perl>...</Perl> and startup.pl equivalent?
Date: 00:18 on 14 Dec 2004
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

(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?
colin_e 00:18 on 14 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