"William R. Ellis" <[EMAIL PROTECTED]> writes:

> Here is the problem snippet:
>       require LWP;
>       require LWP::UserAgent;
>       #snip
>       my $ua = new LWP::UserAgent;
>       $ua->agent('bot name ' . $ua->agent);
>       $ua->from  ('some email');
>       $ua->timeout([180]);

You are not supposed to pass an array reference here.  If you do you
probably end up with a pretty long timeout.  Try

   perl -le "print [180]+0"

>       my $recForcast = new HTTP::Request('GET', 'A-URL');
>       $recForcast->header('Accept' => 'text/html');
>       $recForcast->content_type('application/x-www-form-urlencoded');
>       my $res_forcast = $ua->request($recForcast);
>       $status = res_forcast->status_line;
>       # status_line contains the error string shown:
>       # 500 Can't connect to A-URL:80 (Cannot determine protocol)
> Earlier threads refer to permission problem with etc/protocols
> and IO::Socket::INET. (via Gisle)  The tech at the ISP can't
> find any of these even though "use IO::Socket" doesn't fail.

"/etc/protocols" is what the file is called on Unix systems.  What it
is on Windows I have no clue.

The failure will not show up until you try to connect to a server.
Try this code:

  perl -le "use IO::Socket; print IO::Socket::INET->new(q(www.perl.com:80))||die"

It should print something like "IO::Socket::INET=GLOB(0x811325c)".  I
assume it will print something  with "Cannot determine protocol" for you.
If it does, fix that!

The code that triggers this error is this one (in IO/Socket.pm of perl5.005):

    $proto ||= (getprotobyname "tcp")[2];
    return _error($fh,'Cannot determine protocol')

This error check seems to simply be removed in the IO/Socket/INET.pm of
perl-5.6.1 (and IO-1.20).  I don't know why.  Perhaps Graham remembers?


Reply via email to