Any way to "inject" an INIT block into a different module?
Andy Wardley
abw at wardley.org
Fri May 30 14:31:06 BST 2008
Matt Lawrence wrote:
> BEGIN { our $in_begin = 1 }
> INIT {
> our $in_begin = 0;
> ...
> }
> sub import {
> if (our $in_begin) {
> push @HOOKS, ... ;
> }
> else {
> export ( ... )
> }
> }
That was the next thing I tried, but alas no.
It does the right thing in calling the export method now instead of deferring
it. But then you're back to the export() method being called before the
target package has been compiled so you can't tell if methods are defined or
not.
Thanks all the same.
A
More information about the london.pm
mailing list