bool debug = true; // I think bool is a new C keyword...
if (debug)
{
#include <assert.h>
#include "mydebugstuff.h"
}
The difference is that in C, you can more easily tell what is compile-time and what is run-time based on that hashmark. In Perl, we have the BEGIN block, but most of our compile-time code is actually executed via use.
You're mixing compile-time and run-time code, then, so it doesn't actually work. Someone mentioned the if pragma - but it's not really needed here.
Simply remove the if's. There's nothing wrong with warnings being used at all times. There's also nothing really wrong with loading modules you don't need - slows down compilation, but not much. If's usage is better suited for modules that may not be there than debugging statements that do no harm if they're left in, IMO. Since Data::Dumper is always installed, it's pretty safe to always load.
That said, if you want to avoid loading Data::Dumper, you can learn how to use require - then you will only load it when you need it - at runtime, not compile-time. |