Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: inlned DEBUG constant versus $DEBUG

by dragonchild (Archbishop)
on Sep 18, 2001 at 20:37 UTC ( [id://113155]=note: print w/replies, xml ) Need Help??


in reply to inlined DEBUG constant versus $DEBUG

C's method is to use preprocessing, which I've heard is coming out (in some form) in Perl6. Thus, if DEBUG is set to 0, the compiler would just skip over that code and not even compile it to optimize it away.

As a note, just do

use constant DEBUG => (1);
if you're in 5.6.0 or higher. (It may be available earlier, but I'm not sure.)

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

Replies are listed 'Best First'.
Re:x2 inlined DEBUG constant versus $DEBUG
by grinder (Bishop) on Sep 18, 2001 at 21:26 UTC

    If you are wondering whether use constant is available in versions prior to 5.6.0, it was introduced in 5.004. In fact if you were using the late 5.003 versions (circa 5.003_90+) it was there in betas leading up to 5.004.

    Nevertheless, it's been there for a long time, at least as far as scalars go. Constant hashes and arrays didn't work correctly until around 5.005_03.

    --
    g r i n d e r
Re: Re: inlned DEBUG constant versus $DEBUG
by perrin (Chancellor) on Sep 18, 2001 at 21:41 UTC
    You can use a pre-processor with Perl too. See Filter::cpp.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2025-06-13 10:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.