Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Debug code out of production systems

by graff (Chancellor)
on Jan 25, 2004 at 04:37 UTC ( #323921=note: print w/ replies, xml ) Need Help??


in reply to Debug code out of production systems

This is pretty awesome -- I could see it being applied to a range of things other than debugging (and perhaps some holy wars breaking out about what might constitute overuse or misuse of the idea).

Because of its potential, I think the tendancy to give it a name related to debugging would be... well, constraining or inapt somehow -- it might limit people's perception about what it's really doing, and what it's able to do.

Keeping it as "=begin" seems okay (especially if folks follow Mr. Muskrat's idea of always terminating the conditional code with "=end"). Another possibility would be to call it something like "=run_when" -- e.g.:

=run_when ODDBALL_OS_VERSION. use Local::Module::ForODDOSV; # nice to have a new way to do this! =cut ... while (<BLAH>) { ... =run_when DEBUGGING warn "reading BLAH and got: $_" =cut ... =run_when TESTING $expected = "What should happen here"; warn "This isn't working\n" unless ( $expected eq some_test()); =cut ... =run_when BORED print "Did you do something different with your hair today?\n"; =cut
If you feel that C-like pre-processor directives are really second nature to just about everybody who uses Perl, then you could try "=ifdefined" -- this wouldn't be any worse that "=begin", I think, but really, what's in a name? "bless" by any other name would be no less abstract...

I guess the next thing to wonder about is whether folks might opt for having selected chunks of pod content be produced or not via perldoc, depending on what's in the environment. (This might be tricky -- how to flag the end of the =begin block within pod, without flagging the end of pod as well. Or does the use of "=begin" impose the end of pod processing already? I confess to not having studied pod grammar all that closely.)


Comment on Re: Debug code out of production systems
Download Code
Re: Re: Debug code out of production systems
by liz (Monsignor) on Jan 25, 2004 at 09:52 UTC
    If you feel that C-like pre-processor directives are really second nature to just about everybody who uses Perl, then you could try "=ifdefined" -- this wouldn't be any worse that "=begin"
    Well, I admit being inspired by C preprocessor's directives. Ideally, I would like to use the =if, =ifdef, =elseif and =else and =endif family. However, any of these will cause severe noise with even the standard pod2html and pod2man utilities. And worse, it will include them inside the generated documentation!

    Maybe I should call the pragma "ifdef" and support all of the above pod markers and include =begin and =end (good point "Mr. Muskrat") as synonyms that can be used in the current code base without upsetting current pod parsers?

    Liz

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2014-04-18 07:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (463 votes), past polls