At 13:37 2002-03-03 +0100, Ulrich Wisser wrote:
yes, I try to differentiate between 500 errors
>(sometimes our uplink is down and my software
>doesn't know about it)
>
>I want to know if the answer is from the server I tried
>to reach or if libwww encountered an error and wants to
>tell me about it.

Hm, I expect there's a neater way than this, but this is the best I can
find: Errors that come from the remote HTTP server all seem to have a
"Date:" header, whereas internally-generated ones never seem to.

So you can tell them apart with defined($response->date).
I hope there's a neater way, tho.


C:\utils>perl -d  -e -1
Default die handler restored.
Loading DB routines from perl5db.pl version 1.07
Editor support available.
Enter h or `h h' for help, or `perldoc perldebug' for more help.
main::(-e:1):   -1
   DB<1> use LWP; $browser = LWP::UserAgent->new;
   DB<2> $r1 = $browser->get('http://oeuoeueo.int');
   DB<3> $r2 = $browser>get('http://www.speech.cs.cmu.edu/~sburke/BL00P');
   DB<4> x $r1->date, $r2->date
0  undef
1  1015290033
   DB<5>

--
Sean M. Burke    [EMAIL PROTECTED]    http://www.spinn.net/~sburke/

Reply via email to