Re: LWP::Simple feature request: throw exception on error

2004-02-21 Thread Ed Avis
"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

Re: LWP::Simple feature request: throw exception on error

2004-02-21 Thread Rob Dixon
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

Re: LWP::Simple feature request: throw exception on error

2004-02-21 Thread Andy Lester
> 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

LWP::Simple feature request: throw exception on error

2004-02-21 Thread Ed Avis
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