Any way to "inject" an INIT block into a different module?

Andy Wardley abw at
Fri May 30 15:27:15 BST 2008

Adriano Ferreira wrote:
> That seems like the kind of things Devel::Hook was invented to do.
> However, it is very experimental and imature by now.

Yes, that's exactly what I'm after.  Too bad it relies on XS.  That's
probably going too close to the metal for this particular application.

But at least it tells me that it's not possible to do this kind of thing
from pure Perl, so I'll try a different tack.

My fallback plan is to have an AUTOLOAD method which generates the method
on demand.  I've used this kind of thing before and it works quite well.
It just means you have to always inherit from a base class that implements
the AUTOLOAD, or have the loaded module inject it into the caller which is
that little bit more dodgy.

Thanks everyone.


More information about the mailing list