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

Rafael Garcia-Suarez rgarciasuarez at gmail.com
Fri May 30 14:17:00 BST 2008


2008/5/30 Andy Wardley <abw at wardley.org>:
> Because, of course, the INIT time for my Control class has come and gone.
>
> Now I realise that I can work around this by forcing the caller to do some
> extra work, e.g. define their own INIT block or call a specific method
> to generate the methods at the right time.  But I'm trying to figure out
> if there's a way around it without requiring any extra work in the caller's
> package.  If only for chuckles.
>
> What I think I want to do, in conceptual terms at least, is to have my
> Control module "export" an INIT block/action into the Amp module.  I know
> I can't do that (at least I don't think I can, can I?) but that's the effect
> that I'm after.

A kind of sane way is to use Filter::EOF. (If I understand correctly)

If you like, you can also try to mess with pushing coderefs in
@{B::unitcheck_av()->object_2svref}, but this will require 5.10
anyway, and here be dragons.


More information about the london.pm mailing list