in reply to defined weirdness
For a first step in understanding change your if statement to:
if ( defined $debug ) { print "use SOAP::Lite +trace => 'debug'\n"; } else { print "use SOAP::Lite\n"; }
With an empty command line it prints:
use SOAP::Lite
Now the why: use is processed at compile time so the first "use SOAP..." line is processed first and you get the debug version loaded. When your code runs following compile the use has already been executed so the if makes no difference to the outcome.
Instead of "use", use require:
if ( defined $debug ) { SOAP::Lite->import(trace => 'debug') if require SOAP::Lite; } else { SOAP::Lite->import() if require SOAP::Lite; }
|
|---|