Forum Moderators: coopster & phranque

Message Too Old, No Replies

"Can't connect" error from LWP::Simple

Getting error 500 when using getprint from LWP::Simple

         

saguaro

10:49 pm on Feb 11, 2007 (gmt 0)

10+ Year Member



I've worked with Perl before, but just today starting reading about LWP. I'm trying the very simplest example -

#!C:\Perl\bin\perl.exe -w
use LWP::Simple;
getprint("http://www.cpan.org/RECENT");

I get the following error:

500 Can't connect to www.cpan.org:80 (connect: Unknown error) <URL:http://www.cpan.org/RECENT>

I'm running on a Windows 2000 PC using my ISP - no web server.

In the ActivePerl doc, I read about setting HTTP_proxy env variable, but I'm not sure if this is cause of my problem? If it is, how do I find out that value to set the HTTP_proxy to?

Any help is appreciated.

perl_diver

8:21 pm on Feb 12, 2007 (gmt 0)

10+ Year Member



if you're running a firewall that could be the problem. Shut it down and try again. If not, I'm not sure.

Matt Probert

8:25 pm on Feb 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Firewalls often prevent access from the command prompt under Windows. Try disabling any firewall, and also try accessing the document through a web browser to check it can be retrieved.

Matt

perl_diver

10:40 pm on Feb 12, 2007 (gmt 0)

10+ Year Member



I had no problem from browser and command line, as long as my firewall was shut down.

#!perl
use warnings;
use diagnostics;
use LWP::Simple;
print "Content-type: text/html\n\n"; #<-- for viewing in browser
getprint("http://www.cpan.org/RECENT");

returns a pretty long document....

saguaro

1:47 pm on Feb 14, 2007 (gmt 0)

10+ Year Member



I disabled my firewall and now its working!

Now I wonder if I can configure my firewall to allow this communication to occur without disabling the firewall? I'll check with my firewall provider - unless someone already knows how to do this.

Thanks so much for your help, everyone!

Regards.