Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Re: Re: IYHO, what do you consider good code?

by chromatic (Archbishop)
on Jun 13, 2003 at 23:51 UTC ( #265834=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: IYHO, what do you consider good code?
in thread IYHO, what do you consider good code?

Make it an environment variable and it's even easier:

BEGIN { $ENV{DEBUG} = $ENV{DEBUG} ? 0 : 1; } use constant DEBUG => $ENV{DEBUG};

Update: Good points both responses, though I'm slightly happier with the BEGIN block from a maintenance standpoint.


Comment on Re: Re: Re: IYHO, what do you consider good code?
Download Code
Re: Re: Re: Re: IYHO, what do you consider good code?
by diotalevi (Canon) on Jun 13, 2003 at 23:57 UTC

    Make it a more specific environment variable and you're golden. Alzabo respects the ALZABO_DEBUG environment variable, your modules could do something similar.

Re: Re: Re: Re: IYHO, what do you consider good code?
by Juerd (Abbot) on Jun 19, 2003 at 09:13 UTC

    BEGIN { $ENV{DEBUG} = $ENV{DEBUG} ? 0 : 1; } use constant DEBUG => $ENV{DEBUG};

    Why the BEGIN block?

    use constant DEBUG => !!$ENV{DEBUG};

    Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (15)
As of 2014-09-23 18:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (238 votes), past polls