natxo has asked for the wisdom of the Perl Monks concerning the following question:
Using this:
When I run it like this:use warnings; use strict; use Getopt::Long; # global variables my $warning = 90; my $critical = 30; my $version = 1; my $help = 0; my $host; my $revision; my $debug = undef; my $tag; Getopt::Long::Configure( "no_ignore_case", "bundling" ); GetOptions( 'H|host=s' => \$host, 't|tag=s' => \$tag, 'h|help|?' => \$help, 'v|verbose' => \$debug, 'V|version' => \$revision, 'w|warning=i' => \$warning, 'c|critical=i' => \$critical, ); if ( defined $debug ) { use SOAP::Lite +trace => "debug"; } else { use SOAP::Lite; }
it should not use the SOAP::Lite library with debugging enabled, but it does. I do not understand why. If I remove the if/else loop and just insert a use SOAP::Lite statement it works without debugging, but I would very much prefer to have the choice as a cli option, this script will be used by people who do not know how to debug Perl or any other programming language../code -H localhost
Any clue greatly appreciated. update: I also tried using
but still no changemy $debug = undef;
update 2: thank you for your (very) fast replies. I understand it now and it works great with the import suggestion. I learnt something today :-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: defined weirdness
by Corion (Patriarch) on Nov 01, 2013 at 09:19 UTC | |
|
Re: defined weirdness
by GrandFather (Saint) on Nov 01, 2013 at 09:32 UTC | |
|
Re: defined weirdness (use happens at compile time)
by Anonymous Monk on Nov 01, 2013 at 09:20 UTC |