On 21 May 2004, Gisle Aas wrote:

>>When LWP::Simple::get() fails it would often be useful to print a more
>>informative error message than just 'get failed'.

>I've decided to not apply this patch.  I want to keep the
>LWP::Simple as simple as it can be.  I recommend using the full
>LWP::UserAgent interface if you need the extra error information.  
>Also interfaces involving globals are not really pleasant.

My feeling is that the truly simple interface would throw an exception
with an informative message on error, and then you wouldn't have to
manually check the return value for each call.  But this suggestion
wasn't well received on the list.

You make a good point about global variables, however I felt it was
overridden by the importance of usable error reporting.  The global $!
for error messages is rather ugly, but still any good beginner's Perl
tutorial recommends to always put $! in every error message.

At the moment I have an application which uses LWP::Simple but I'm
having difficulty getting usable bug reports from users.  The app can
only print 'download failed' but once you know the reason it failed
the problem is much easier to fix.  At the moment I have to send out
perl oneliners for the users to run to find out the problem, since
there is no way to get LWP::Simple to return the error message.

It looks like there is a niche for a library that makes it simple to
download URLs, but also makes it simple to do the right thing, which
in my opinion means always checking the success of each call and 
giving an informative error message.

Might you include such a library (with interface similar to
LWP::Simple) in the LWP bundle, or should I distribute it separately?

-- 
Ed Avis <[EMAIL PROTECTED]>


Reply via email to