Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'm using perl's -P option so that I can prevent blocks of code from being compiled by perl when I'm not debugging.
It seems to be working very well, except that I need to extend the concept to some supporting modules, which have been created with 'h2xs -X' and are using autoloader.
Basically, I want my main program to be something like:
#!/usr/local/bin/perl -P #define DEBUG 1
Then in my module methods, I want to be allowed to do this:
#ifdef DEBUG &big_expensive_function(); #endif
The problem is that the c pre-processor doesn't seem to work within the modules. And the code block is being executed every single time, regardless of how DEBUG is set.
I know I could just use a perl if(). But in the end product, I'd end up processing multiple if's on the order of millions of times, and efficency is very important.
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: C pre-processor
by chromatic (Archbishop) on May 01, 2001 at 23:20 UTC | |
by tilly (Archbishop) on May 01, 2001 at 23:31 UTC |