in reply to Re^3: Mini-rant about 'strict'
in thread Mini-rant about 'strict'

Eh. People probably shouldn't do this anyway but it is possible.

use B; BEGIN { B::save_BEGINs() } BEGIN { "Boo!" } print $_->object_2svref->() for B::begin_av->ARRAY; # Corrected by adding ->ARRAY. I forgot that begin_av does not return # a list, it returns a [cpan://B]::AV object which must have ->ARRAY # called on it to get the contents.

Replies are listed 'Best First'.
Re^5: Mini-rant about 'strict'
by Aristotle (Chancellor) on Aug 05, 2004 at 21:33 UTC

    That gives me Not a CODE reference because B::begin_av returns an array ref. And the array is empty.

    Even if that code worked, it wouldn't really prove much. BEGIN blocks still don't behave like subs, even though you can use introspection magick to cast an elephant into a mouse. The existence of PadWalker doesn't make lexicals globals either.

    Makeshifts last the longest.