Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

problem with LWP

by mutatedgene (Novice)
on Jun 02, 2006 at 19:23 UTC ( [id://553358]=perlquestion: print w/replies, xml ) Need Help??

mutatedgene has asked for the wisdom of the Perl Monks concerning the following question:

Hello Perl Monks

okay so i have this problem with using the LWP library.

I have jsut sttarted learning how to use it so im using this very simple program that gets the page of the given url

#!usr/bin/perl use LWP::Simple; getprint($ARGV[0]); exit;

when i run this program it seems to get stuck in an infinite loop. when i ran it using the debugger this was the final error that i got when i just skipped running throught the modules
IO::Socket::connect(/usr/lib/perl5/5.8.0/i386-linux-thread-multi/IO/So +cket.pm:121): 121: $err = $! || (exists &Errno::ETIMEDOUT ? &Errn +o::ETIMEDOUT : 1);

so i ran thro the debugger line by line and as suspected it gets stuck in an infinite loop. the following are the lines of code that kept repeating as given by the debugger
im sorry if im being a little too descriptive. just that i really didnt understand whats going on so i jus copied the lines from the terminal
HTTP::Headers::CODE(0x82e8db0)(/usr/lib/perl5/site_perl/5.8.0/HTTP/Hea +ders.pm:59): 59: for (@header_order) { DB<8> HTTP::Headers::CODE(0x82e8db0)(/usr/lib/perl5/site_perl/5.8.0/HTTP/Hea +ders.pm:60): 60: my $lc = lc $_; DB<8> s HTTP::Headers::CODE(0x82e8db0)(/usr/lib/perl5/site_perl/5.8.0/HTTP/Hea +ders.pm:61): 61: $header_order{$lc} = ++$i; DB<8> s HTTP::Headers::CODE(0x82e8db0)(/usr/lib/perl5/site_perl/5.8.0/HTTP/Hea +ders.pm:62): 62: $standard_case{$lc} = $_; DB<8> s

these are the four lines that keep repeating in the debugger. im not able to go beyond this

can anyone tell me what is going on andhow i solve this problem?? plz help!!. will be really grateful!!

Arvind

Edit: g0n code tags round output data

Replies are listed 'Best First'.
Re: problem with LWP
by fishbot_v2 (Chaplain) on Jun 03, 2006 at 01:51 UTC

    So, the bit that keeps repeating in the debugger is a red herring, I think. If you take a look at that section of the code, it repeats about 40 or 50 times - it looks like an infinite loop if you step through it in the debugger, but at run time certainly less than a second. Barring an extremely broken Perl, I don't see how that code could be looping infinitely. (It just builds indexes of common HTTP headers... and at module load-time, to boot.)

    My wild guess is that the socket issue is closer to the heart of the problem. Is there perhaps a proxy issue? Can you telnet to port 80 from your terminal?

      yeah! u got it bang on!!

      it was a proxy issue... got it solved.. thanks a mil for the help!!
Re: problem with LWP
by ercparker (Hermit) on Jun 03, 2006 at 00:24 UTC
    I ran this prompt>./lwp.pl http://amazon.com and it works fine on OSX:
    #!/usr/bin/perl use strict; use warnings; use LWP::Simple; print get($ARGV[0]); exit;
      hey ..

      thanks.. the problem was with the proxy.. got it corrected with a lil help from the monks at the CB.. thanks for helping!!
Re: problem with LWP
by PodMaster (Abbot) on Jun 03, 2006 at 11:59 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://553358]
Approved by atcroft
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-19 21:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found