> use Pod::Usage if $needPod;
Timing! You can't make a compile-time use (the BEGIN-part) depend on run-time conditions.
FWIW: you could use the if pragma, but only if the condition is available at compile-time
Because use takes effect at compile time, it doesn't respect the ordinary flow control of the code being compiled. In particular, putting a use inside the false branch of a conditional doesn't prevent it from being processed. If a module or pragma only needs to be loaded conditionally, this can be done using the if pragma:
use if $] < 5.008, "utf8";
use if WANT_WARNINGS, warnings => qw(all);
but as you see the conditions here are (compile time) constants
|