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

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

Thread Previous | Thread Next
From:
Elizabeth Mattijsen
Date:
December 3, 2003 05:30
Subject:
Re: [DOCPATCH] BEGIN, CHECK, INIT, END explained more
Message ID:
p05111b03bbf39565bac0@[192.168.56.3]
At 13:15 +0000 12/3/03, Arthur Bergman wrote:
>On Wednesday, December 3, 2003, at 12:43  pm, Rafael Garcia-Suarez wrote:
>>Nope -- they are useful to exactly one and precisely defined thing : the
>>B:: modules. Every other use of CHECK/INIT is a bad hack.
>>
>>What's needed IMO is yet another special code block -- COMPILED, START,
>>better names welcome -- run when the compilation of the said compilation
>>unit ends, regardless of the state of the main perl interpreter.
>No I disagree, I want to know apply the B::module magic after I 
>require something runtime too.
>I guess what we need is a hook that gets called whenever a 
>compilation of a outer lexical scope (file, eval"") is completed.

That could be done in a module, I think.

It's all a matter of how you would specify what needs to be run, 
especially if you have multiple package in a single file.  But 
assuming you would require "Foo.pm", it would be easy to have a 
Foo->REQUIRED routine run after the require was successful.

Just a matter of stealing CORE::require...  ;-)


Liz

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