in reply to Re: Is modifying the symbol table to redefine subroutines evil?
in thread Is modifying the symbol table to redefine subroutines evil?

Seriously, what's wrong with a much easier approach like this?

It could be much easier to read:

if (not $FOO_HAS_BEEN_CALLED) {

... if it were instead:

unless ($FOO_HAS_BEEN_CALLED) {

Otherwise, it seems reasonable.

Replies are listed 'Best First'.
Re^3: Is modifying the symbol table to redefine subroutines evil?
by perrin (Chancellor) on Apr 12, 2007 at 18:29 UTC
    Now that you mention it, I usually handle this kind of bail-out conditional with a simple test at the top:
    return if $foo_has_been_called;
    Then you don't have to indent the whole rest of the sub.