Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: To DEBUG, or to COMMENT. _That_ is the question

by sundialsvc4 (Abbot)
on Nov 08, 2013 at 22:10 UTC ( #1061782=note: print w/ replies, xml ) Need Help??


in reply to To DEBUG, or to COMMENT. _That_ is the question

I have always wished for ... and, this being Perl so I’m sure it must exist I just don’t know of it ... an #if .. preprocessor capability, a la C/C++.   I would like “true conditional-compilation,” for any purpose including but not limited to the insertion of debugging code.   I am not familiar with this particular module enough to comment on its merits.   Certainly, these messaging techniques are crucial to the successful debugging and maintenance of production code ... whether done in this particular way or not.   Thanks for pointing out this module ... it seems well worth a closer look.


Comment on Re: To DEBUG, or to COMMENT. _That_ is the question
Re^2: To DEBUG, or to COMMENT. _That_ is the question
by chromatic (Archbishop) on Nov 08, 2013 at 22:42 UTC

    How about the -P flag, as documented in perlrun (with a huge list of caveats)?

      The -P command-line switch was deprecated in perl version 5.10.0 and removed as of version 5.12.0 (see perl5120delta). But the equivalent behaviour is provided by the module Filter::cpp:

      #! perl use strict; use warnings; use Filter::cpp; #define DEBUG #define XYZ 42 #ifdef DEBUG print "Debugging enabled\n"; #else print "Debugging disabled\n"; #endif print XYZ . "\n";

      Output:

      13:14 >perl 772_SoPW.pl Debugging enabled 42 13:14 >

      See perlfilter.

      Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

        You're right, of course. For some reason I had a terminal window open with a Perl 5.10.1 environment and chose that one to run perldoc instead of anything more recent.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2014-09-20 02:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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











    Results (151 votes), past polls