http://www.perlmonks.org?node_id=803868


in reply to How do I know if I'm in a BEGIN block?

See perlmod.

BEGIN { $I_AM_COMPILING = 1 } INIT { $I_AM_COMPILING = 0 } sub foo { if ( ! $I_AM_COMPILING ) { } }

I don't know if that will work, but that's what I'd try first.

Replies are listed 'Best First'.
Re^2: How do I know if I'm in a BEGIN block?
by dgaramond2 (Monk) on Oct 29, 2009 at 13:59 UTC
    Thanks! I feel so stupid for not having come up with that myself :-(