Amoe has asked for the wisdom of the Perl Monks concerning the following question:
But it gives the warning "Argument "x" isn't numeric in numeric eq (==)". Now, obviously this is the fault of $opt_p == 1. That's there because if the switch has no argument, $opt_p is 1. But doesn't that expression return 0 anyway if the argument is a string? And if it does, why isn't the proxy getting set when I run it in debug mode with params?use strict; use warnings; use Getopt::Std; use LWP::UserAgent; our($opt_p); getopt('p'); my $agent = LWP::UserAgent->new(); ($opt_p == 1 ? $agent->env_proxy() : $agent->proxy(http => $opt_p)) if + (defined($opt_p));
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Getting commandline params
by tachyon (Chancellor) on Sep 01, 2001 at 22:07 UTC | |
|
Re: Getting commandline params
by tachyon (Chancellor) on Sep 02, 2001 at 01:50 UTC | |
by Amoe (Friar) on Sep 02, 2001 at 15:33 UTC | |
by tachyon (Chancellor) on Sep 02, 2001 at 16:09 UTC | |
|
Re: Getting commandline params
by tachyon (Chancellor) on Sep 02, 2001 at 17:27 UTC |