Really? If you leave the 'use ifdef' in your code, it will only marginally affect your load time, won't really affect your compile time (just the part of ignoring POD), and won't affect runtime at all.
Or, another way to look at it is that commenting out the "use ifdef" line is way easier than commenting out all the DEBUGGING lines. :-)
One minor advantage here is that you can control which files have ifdef in them - by only putting them in the files you actually want to debug at a given time, you can just get your debugging info from those modules - a significantly reduced set of messages which may make it easier to debug. Minor, but still an advantage.
What's really unfortunate is that the lib module doesn't play too nice here. We could, however, write a new module, say lib::clean, which would go and reorder the @INC such that all CODE refs are pushed to the front. Then you just need to use it:
package lib::clean; sub import { my (@coderefs, @rest); foreach (@INC) { if (ref $_ && ref $_ eq 'CODE') { push @coderefs, $_; } else { push @rest, $_; } } @INC = (@coderefs, @rest); } 1;
And just 'use lib::clean;' after the 'use lib' line. Just testing that, and it seems to work, too.
In reply to Re^7: ifdef in modules
by Tanktalus
in thread ifdef in modules
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |