Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Is modifying the symbol table to redefine subroutines evil?

by chromatic (Archbishop)
on Apr 11, 2007 at 23:19 UTC ( #609523=note: print w/ replies, xml ) Need Help??


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.


Comment on Re^2: Is modifying the symbol table to redefine subroutines evil?
Select or Download Code
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://609523]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2015-07-05 23:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (68 votes), past polls