develooper Front page | perl.perl5.porters | Postings from December 2003

Re: [DOCPATCH] BEGIN, CHECK, INIT, END explained more

Thread Previous | Thread Next
Rafael Garcia-Suarez
December 3, 2003 03:19
Re: [DOCPATCH] BEGIN, CHECK, INIT, END explained more
Message ID:
Elizabeth Mattijsen wrote:
> At 23:28 +0100 12/2/03, Rafael Garcia-Suarez wrote:
> >I took the liberty to correct some errors, notably on the mechanism
> >behind O and B : this is not the CHECK block that stops the program, as
> >you wrote, and it's defined from inside an eval(""), whereas you stated
> >that CHECK/INIT blocks were ignored in eval("")s. (This eval happens
> >at compile-time when you load the O module, so it's OK.)
> Hmmm....  I believe you, the O and B modules are a bit messy...
> So when _are_ CHECK/INIT blocks run then exactly?  Is the definition 
> just as :they're only run once after compilation of the first outer 
> eval is completed?

CHECK and INIT blocks are run at the end of the compilation of the main
program. The fact that they were defined from inside an eval("") doesn't
matter. If the eval("") happened during the compilation of the main
program, they will be run. If it happened after the main program was
compiled, they will not.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About