Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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

Replies are listed 'Best First'.
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";


      13:14 >perl 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?

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2018-05-22 03:19 GMT
Find Nodes?
    Voting Booth?