* Boris 'pi' Piwinger wrote:
>After some discussion in de.comp.lang.perl.misc
>(<[EMAIL PROTECTED]> ff) I assume there is a bug in
>LWP::UserAgent. I have a while loop reading URLs from a file. Those
>are fetched, if unsuccessful the response code and message are
>printed. The message becomes, e.g.:
>
>Can't connect to www.polybytes.com:80 (No route to host), <FILE> chunk
>1.
>
>Obviously everything from the comma on is not correct at this place.
>Someone suggested that in LWP::Protocol::http::_new_socket the message
>does not end in \n.

Yes, that was me. die() is used there and `perldoc -f die` reads

| If the value of EXPR does not end in a newline, the current
| script line number and input line number (if any) are also
| printed, and a newline is supplied. Note that the "input line
| number" (also known as "chunk") is subject to whatever notion of
| "line" happens to be currently in effect, and is also available
| as the special variable `$.'. See the section on "$/" in the
| perlvar manpage and the section on "$." in the perlvar manpage.

In LWP::UserAgent this is caught:

|     if ($use_eval) {
|       # we eval, and turn dies into responses below
|       eval {
|           $response = $protocol->request($request, $proxy,
|                                          $arg, $size, $timeout);
|       };
|       if ($@) {
|           $@ =~ s/\s+at\s+\S+\s+line\s+\d+\.?\s*//;
|           $response =
|             HTTP::Response->new(&HTTP::Status::RC_INTERNAL_SERVER_ERROR,
|                                 $@);
|       }

The regular expression should be extended to remove also

  /,\s+<HANDLE>\s+(?:line|chunk)\s+\d+\.?\s*/
-- 
Björn Höhrmann ^ mailto:[EMAIL PROTECTED] ^ http://www.bjoernsworld.de
am Badedeich 7 ° Telefon: +49(0)4667/981028 ° http://bjoern.hoehrmann.de
25899 Dagebüll # PGP Pub. KeyID: 0xA4357E78 # http://learn.to/quote [!]e
        -- If something is worth writing it is worth keeping --         

Reply via email to