in reply to Include module at compile time with condition
Yet another slightly different way to accomplish this. Note the BEGIN is redundant
use constant ({ START => 1000, NO_OF_CALLS => 1, DEBUG => 1, DET_DEBUG => 1, TOTAL_TIME => 1, DETAILED_TIME => 1, RESPONSE => 1, SLEEP => undef, MICRO_SEC => 1, }); use if MICRO_SEC, qw(Time::HiRes time);
And before learning about the if package, I'd do the following:
BEGIN { if (MICRO_SEC) { require Time::HiRes; Time::HiRes->import('time'); } }
|
|---|