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 that might use
this module, you'll want to die() when a page could not be fetched.
Even in larger programs where some recovery is possible you might
prefer explicit error handling using die() to throw exceptions and
eval {} to catch them.

So it would be useful for LWP::Simple to have a global flag saying
'die on error, rather than returning undef'.  This would apply to
head(), getprint() and the other methods as well as get().  The
failure message passed to die() could include the URL and any status
information like the HTTP response code.

Do you think this is a good idea?  Should I send a patch?

-- 
Ed Avis <[EMAIL PROTECTED]>


Reply via email to