"Rob Dixon" <[EMAIL PROTECTED]> writes:
>>So it would be useful for LWP::Simple to have a global flag saying
>>'die on error, rather than returning undef'.
>All of the comparable Perl operations that I know about, including
>all the Net:: modules, return a false value if they've failed.
>In all t
Ed Avis rote:
>
> If LWP::Simple::get() fails it returns undef. So if you want to check
> for errors you do something like
>
> my $got = get($url);
> if (not defined $got) {
> # Handle error somehow, perhaps by dying
> }
> do_something_with($got);
>
> But a lot of the
> my $got = get($url);
> if (not defined $got) {
> # Handle error somehow, perhaps by dying
> }
> do_something_with($got);
my $mech = WWW::Mechanize->new( autocheck=>1 );
$mech->get( $url );
$got = $mech->content;
Mechanize is a wrapper around LWP::UserAgent. The autochec
If LWP::Simple::get() fails it returns undef. So if you want to check
for errors you do something like
my $got = get($url);
if (not defined $got) {
# Handle error somehow, perhaps by dying
}
do_something_with($got);
But a lot of the time, especially in 'simple' scripts th