Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Redefining Imported Subs: of scope and no

by Dallaylaen (Friar)
on Feb 11, 2013 at 13:46 UTC ( #1018142=note: print w/replies, xml ) Need Help??


in reply to Redefining Imported Subs: of scope and no

Don't mess with say, it will byte you or a later maintainer of this code.

Instead, (1) define sub debug {...}; with a plain old if inside. (2) Replace all occurences of say with debug(). (3) Replace those say's that aren't really for debugging back again. (4) Re-run your tests to see if anything got lost.

You can then consider moving debug() to a separate module for re-use, or switch to Log4perl altogether as other monk suggests here, or even write a debug_off() sub that replaces debug() on the fly. But at least it's not like "Hey, say() prints nothing! Our perl interpreter must be broken!"

  • Comment on Re: Redefining Imported Subs: of scope and no

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1018142]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (12)
As of 2017-12-18 20:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (497 votes). Check out past polls.

    Notices?