in reply to call a modules INIT-section
Remove the grep line to get unrun INITs for any module.# pass a module name # returns list or count of coderefs for unrun INITs in the given modul +e # empty list/undef if something goes wrong sub get_inits_for_module { use 5.008001; use B; my $mod = shift; eval { map $_->object_2svref, grep $_->GV->STASH->NAME eq $mod, B::init_av->ARRAY } }
In general, any module should provide something that can be called to initialize it for circumstances where INIT doesn't get run, so you shouldn't ever have to do this.
|
|---|