develooper Front page | perl.perl5.porters | Postings from October 2010

Re: [RFC] Exposing PL_dirty to perl space

Thread Previous | Thread Next
From:
Florian Ragwitz
Date:
October 3, 2010 22:34
Subject:
Re: [RFC] Exposing PL_dirty to perl space
Message ID:
87fwwmy12p.fsf@tardis.home.perldition.org
Eric Brine <ikegami@adaelis.com> writes:

> On Sat, Oct 2, 2010 at 1:58 PM, Florian Ragwitz <rafl@debian.org> wrote:
>
>> This very much makes sense to me, and I've implemented a ${^PHASE}
>> global allowing to differentiate between these phases:
>>
>>  - initial interpreter construction
>>  - initial compile-time
>>  - running CHECK blocks
>>  - running INIT blocks
>>  - run-time
>>  - running END blocks
>>  - global destruction
>>
>
> BEGIN { $SIG{__WARN__} = sub { ... }; } 123; print 456;
>
> If the above occurred in a module, your scheme would report run-time
> in the callback were the module required then. I would like the
> handler to know it was called by the compiler.

Yes, during run-time the global phase of the interpreter is run-time.

Also, BEGIN blocks don't necessarily have anything to do with perl's
initial compile phase. While BEGIN blocks in the main program and
everything that loads during compile time are executed during the global
compile phase, any code you compile later on, with require, string
evals, or whatever, will also execute BEGIN blocks, but not during the
global compilation phase.

I think you're looking for a feature ${^PHASE} doesn't aim to provide.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About