in reply to Let a module call a sub of the caller
Should call "foo" after compilation (not during BEGIN). Could the module somehow define an INIT block that calls the sub?
The problem with that is that modules INIT and runtime are still compile time from the perspective of the calling script.
You could run it in an END block, which is also after compilation, but I could imagine that that's too late for your purpose. So I don't know any solution, except via source filters (or maybe evil hijacking of DESTROY subs, depending on when exactly the routine should run).
Speaking of which, what is your purpose? Maybe there's a better solution to it if we know the bigger picture.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Let a module call a sub of the caller
by voj (Acolyte) on Sep 07, 2012 at 07:22 UTC | |
by moritz (Cardinal) on Sep 07, 2012 at 10:02 UTC |
In Section
Seekers of Perl Wisdom