Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^5: LWP - 500 Internal Error

by Anonymous Monk
on Sep 01, 2009 at 21:41 UTC ( #792742=note: print w/ replies, xml ) Need Help??


in reply to Re^4: LWP - 500 Internal Error
in thread LWP - 500 Internal Error

I was expecting as mentioned in the link you sent that this particular part of the code would work like a sniffer and decipher more information as to why it fails

Like I said in that link you use $err to get more info about which Unknown Error it is. You only look if the request fails, and only because "Unknown Error" is diagnostically useless. $! expands to "Unknown Error" for too many errors, like

(100)(Unknown error)(100)(Cannot create another system semaphore) (101)(Unknown error)(101)(The exclusive semaphore is owned by another +process) (102)(Unknown error)(102)(The semaphore is set and cannot be closed) (103)(Unknown error)(103)(The semaphore cannot be set again) (104)(Unknown error)(104)(Cannot request exclusive semaphores at inter +rupt time) (105)(Unknown error)(105)(The previous ownership of this semaphore has + ended) (106)(Unknown error)(106)(Insert the diskette for drive %1)
You're also supposed to look at print $response->dump,"\n"; on error, because it might contain more than "Unknown Error"


Comment on Re^5: LWP - 500 Internal Error
Select or Download Code
Re^6: LWP - 500 Internal Error
by oalvi (Initiate) on Sep 02, 2009 at 07:41 UTC
    Thanks again,

    I tried the script, adding the dump line again and it came back with the following results

    A successfull 200 OK comes out like this

    E:\ovXtras\SCRIPTING>debugurltestv5.pl http://www.elm.com.sa http://192.168.5.5:8080/ 200 OK Err : (9)(Bad file descriptor)(0)() Can't locate object method "dump" via package "HTTP::Headers" at (eval + 28) line 1.

    while an unsuccessful attempt has some additional info

    E:\ovXtras\SCRIPTING>debugurltestv5.pl https://www.ehealth.com.sa http://192.168.5.5:8080/ 500 Internal Server Error Err : (9)(Bad file descriptor)(10038)(An operation was attempted on so +mething that is not a socket) Can't locate object method "dump" via package "HTTP::Headers" at (eval + 28) line 1.

    Can anything be concluded from this?

    My present code below

    # !C:\Perl\bin use strict; use warnings; use LWP::UserAgent; #@ARGV = qw[ http://www.eserve.com.sa/ ]; my $url = shift or die "URL expected\n"; my $useragent = LWP::UserAgent->new; $useragent->proxy(['http', 'ftp','https'], 'http://192.168.5.5:8080/') +; $useragent -> timeout( 20 ); my $request = HTTP::Request->new( GET => $url ); my $response = $useragent->request($request); my $err = sprintf "(%d)(%s)(%d)(%s)\n", $!,$!,$^E,$^E; print $useragent->proxy('http'),"\n"; print $response->status_line, "\n"; print "Err : $err \n"; print $response->dump,"\n";
      You should have tried that ages ago. And you should have tried this
      lwp-request -useUS -m head http://www.eserve.com.sa/ lwp-request -useUS -m get http://www.eserve.com.sa/
      ages ago. You should upgrade LWP to the latest version.
        The outputs for these two commands are as follows:
        C:\Documents and Settings\HP-OVE-User>lwp-request -useUS -m head http: +//www.eser ve.com.sa Use of uninitialized value $scheme in hash element at C:/Program Files +/Perl/lib/ LWP/Protocol.pm line 53. Use of uninitialized value $scheme in pattern match (m//) at C:/Progra +m Files/Pe rl/lib/LWP/Protocol.pm line 56. Use of uninitialized value $scheme in concatenation (.) or string at C +:/Program Files/Perl/lib/LWP/Protocol.pm line 36. Use of uninitialized value $scheme in string eq at C:/Program Files/Pe +rl/lib/LWP /UserAgent.pm line 199. HEAD http://www.eserve.com.sa User-Agent: lwp-request/5.810 HEAD http://www.eserve.com.sa --> 501 Protocol scheme '' is not suppor +ted Content-Type: text/plain Client-Date: Wed, 02 Sep 2009 11:21:49 GMT Client-Warning: Internal response C:\Documents and Settings\HP-OVE-User>lwp-request -useUS -m get http:/ +/www.eserv e.com.sa Use of uninitialized value $scheme in hash element at C:/Program Files +/Perl/lib/ LWP/Protocol.pm line 53. Use of uninitialized value $scheme in pattern match (m//) at C:/Progra +m Files/Pe rl/lib/LWP/Protocol.pm line 56. Use of uninitialized value $scheme in concatenation (.) or string at C +:/Program Files/Perl/lib/LWP/Protocol.pm line 36. Use of uninitialized value $scheme in string eq at C:/Program Files/Pe +rl/lib/LWP /UserAgent.pm line 199. GET http://www.eserve.com.sa User-Agent: lwp-request/5.810 GET http://www.eserve.com.sa --> 501 Protocol scheme '' is not support +ed Content-Type: text/plain Client-Date: Wed, 02 Sep 2009 11:21:54 GMT Client-Warning: Internal response 501 Protocol scheme '' is not supported

        As for LWP, I presently have version 5.814

        I've tried upgrading using cpan, but since its already a network issue I'm troubleshooting, I get stuck ... it says I have the latest version, probably because it couldn't connect

        cpan> install Bundle::LWP Fetching with LWP: http://ppm.activestate.com/CPAN/authors/01mailrc.txt.gz Use of uninitialized value $scheme in hash element at C:\Program Files +\Perl\lib/ LWP/Protocol.pm line 53. Use of uninitialized value $scheme in pattern match (m//) at C:\Progra +m Files\Pe rl\lib/LWP/Protocol.pm line 56. Use of uninitialized value $scheme in concatenation (.) or string at C +:\Program Files\Perl\lib/LWP/Protocol.pm line 36. Use of uninitialized value $scheme in string eq at C:\Program Files\Pe +rl\lib/LWP /UserAgent.pm line 199. LWP failed with code[501] message[Protocol scheme '' is not supported] Fetching with LWP: http://cpan.perl.org/authors/01mailrc.txt.gz Use of uninitialized value $scheme in hash element at C:\Program Files +\Perl\lib/ LWP/Protocol.pm line 53. Use of uninitialized value $scheme in pattern match (m//) at C:\Progra +m Files\Pe rl\lib/LWP/Protocol.pm line 56. Use of uninitialized value $scheme in concatenation (.) or string at C +:\Program Files\Perl\lib/LWP/Protocol.pm line 36. Use of uninitialized value $scheme in string eq at C:\Program Files\Pe +rl\lib/LWP /UserAgent.pm line 199. LWP failed with code[501] message[Protocol scheme '' is not supported] No external ftp command available I would like to connect to one of the following sites to get 'authors/ +01mailrc.t xt.gz': http://www.perl.org/CPAN/ ftp://ftp.perl.org/pub/CPAN/ Is it OK to try to connect to the Internet? [yes] Fetching with LWP: http://www.perl.org/CPAN/authors/01mailrc.txt.gz Use of uninitialized value $scheme in hash element at C:\Program Files +\Perl\lib/ LWP/Protocol.pm line 53, <STDIN> line 1. Use of uninitialized value $scheme in pattern match (m//) at C:\Progra +m Files\Pe rl\lib/LWP/Protocol.pm line 56, <STDIN> line 1. Use of uninitialized value $scheme in concatenation (.) or string at C +:\Program Files\Perl\lib/LWP/Protocol.pm line 36, <STDIN> line 1. Use of uninitialized value $scheme in string eq at C:\Program Files\Pe +rl\lib/LWP /UserAgent.pm line 199, <STDIN> line 1. LWP failed with code[501] message[Protocol scheme '' is not supported] Fetching with LWP: ftp://ftp.perl.org/pub/CPAN/authors/01mailrc.txt.gz LWP failed with code[500] message[LWP::Protocol::MyFTP: connect: timeo +ut] Fetching with Net::FTP: ftp://ftp.perl.org/pub/CPAN/authors/01mailrc.txt.gz Could not connect to host 'ftp.perl.org' with Net::FTP Fetching with Net::FTP ftp://ftp.perl.org/pub/CPAN/authors/01mailrc.txt.gz.gz Could not connect to host 'ftp.perl.org' with Net::FTP No external ftp command available Please check, if the URLs I found in your configuration file (http://ppm.activestate.com/CPAN, http://cpan.perl.org) are valid. The urllist can be edited. E.g. with 'o conf urllist push ftp://myurl/' Could not fetch authors/01mailrc.txt.gz Fetching with LWP: http://ppm.activestate.com/CPAN/modules/02packages.details.txt.gz Use of uninitialized value $scheme in hash element at C:\Program Files +\Perl\lib/ LWP/Protocol.pm line 53. Use of uninitialized value $scheme in pattern match (m//) at C:\Progra +m Files\Pe rl\lib/LWP/Protocol.pm line 56. Use of uninitialized value $scheme in concatenation (.) or string at C +:\Program Files\Perl\lib/LWP/Protocol.pm line 36. Use of uninitialized value $scheme in string eq at C:\Program Files\Pe +rl\lib/LWP /UserAgent.pm line 199. LWP failed with code[501] message[Protocol scheme '' is not supported] Fetching with LWP: http://cpan.perl.org/modules/02packages.details.txt.gz Use of uninitialized value $scheme in hash element at C:\Program Files +\Perl\lib/ LWP/Protocol.pm line 53. Use of uninitialized value $scheme in pattern match (m//) at C:\Progra +m Files\Pe rl\lib/LWP/Protocol.pm line 56. Use of uninitialized value $scheme in concatenation (.) or string at C +:\Program Files\Perl\lib/LWP/Protocol.pm line 36. Use of uninitialized value $scheme in string eq at C:\Program Files\Pe +rl\lib/LWP /UserAgent.pm line 199. LWP failed with code[501] message[Protocol scheme '' is not supported] No external ftp command available Fetching with LWP: http://www.perl.org/CPAN/modules/02packages.details.txt.gz Use of uninitialized value $scheme in hash element at C:\Program Files +\Perl\lib/ LWP/Protocol.pm line 53. Use of uninitialized value $scheme in pattern match (m//) at C:\Progra +m Files\Pe rl\lib/LWP/Protocol.pm line 56. Use of uninitialized value $scheme in concatenation (.) or string at C +:\Program Files\Perl\lib/LWP/Protocol.pm line 36. Use of uninitialized value $scheme in string eq at C:\Program Files\Pe +rl\lib/LWP /UserAgent.pm line 199. LWP failed with code[501] message[Protocol scheme '' is not supported] Fetching with LWP: ftp://ftp.perl.org/pub/CPAN/modules/02packages.details.txt.gz LWP failed with code[500] message[LWP::Protocol::MyFTP: connect: timeo +ut] Fetching with Net::FTP: ftp://ftp.perl.org/pub/CPAN/modules/02packages.details.txt.gz Could not connect to host 'ftp.perl.org' with Net::FTP Fetching with Net::FTP ftp://ftp.perl.org/pub/CPAN/modules/02packages.details.txt.gz.gz Could not connect to host 'ftp.perl.org' with Net::FTP No external ftp command available Please check, if the URLs I found in your configuration file (http://ppm.activestate.com/CPAN, http://cpan.perl.org) are valid. The urllist can be edited. E.g. with 'o conf urllist push ftp://myurl/' Could not fetch modules/02packages.details.txt.gz Fetching with LWP: http://ppm.activestate.com/CPAN/modules/03modlist.data.gz Use of uninitialized value $scheme in hash element at C:\Program Files +\Perl\lib/ LWP/Protocol.pm line 53. Use of uninitialized value $scheme in pattern match (m//) at C:\Progra +m Files\Pe rl\lib/LWP/Protocol.pm line 56. Use of uninitialized value $scheme in concatenation (.) or string at C +:\Program Files\Perl\lib/LWP/Protocol.pm line 36. Use of uninitialized value $scheme in string eq at C:\Program Files\Pe +rl\lib/LWP /UserAgent.pm line 199. LWP failed with code[501] message[Protocol scheme '' is not supported] Fetching with LWP: http://cpan.perl.org/modules/03modlist.data.gz Use of uninitialized value $scheme in hash element at C:\Program Files +\Perl\lib/ LWP/Protocol.pm line 53. Use of uninitialized value $scheme in pattern match (m//) at C:\Progra +m Files\Pe rl\lib/LWP/Protocol.pm line 56. Use of uninitialized value $scheme in concatenation (.) or string at C +:\Program Files\Perl\lib/LWP/Protocol.pm line 36. Use of uninitialized value $scheme in string eq at C:\Program Files\Pe +rl\lib/LWP /UserAgent.pm line 199. LWP failed with code[501] message[Protocol scheme '' is not supported] No external ftp command available Fetching with LWP: http://www.perl.org/CPAN/modules/03modlist.data.gz Use of uninitialized value $scheme in hash element at C:\Program Files +\Perl\lib/ LWP/Protocol.pm line 53. Use of uninitialized value $scheme in pattern match (m//) at C:\Progra +m Files\Pe rl\lib/LWP/Protocol.pm line 56. Use of uninitialized value $scheme in concatenation (.) or string at C +:\Program Files\Perl\lib/LWP/Protocol.pm line 36. Use of uninitialized value $scheme in string eq at C:\Program Files\Pe +rl\lib/LWP /UserAgent.pm line 199. LWP failed with code[501] message[Protocol scheme '' is not supported] Fetching with LWP: ftp://ftp.perl.org/pub/CPAN/modules/03modlist.data.gz LWP failed with code[500] message[LWP::Protocol::MyFTP: connect: timeo +ut] Fetching with Net::FTP: ftp://ftp.perl.org/pub/CPAN/modules/03modlist.data.gz Could not connect to host 'ftp.perl.org' with Net::FTP Fetching with Net::FTP ftp://ftp.perl.org/pub/CPAN/modules/03modlist.data.gz.gz Could not connect to host 'ftp.perl.org' with Net::FTP No external ftp command available Please check, if the URLs I found in your configuration file (http://ppm.activestate.com/CPAN, http://cpan.perl.org) are valid. The urllist can be edited. E.g. with 'o conf urllist push ftp://myurl/' Could not fetch modules/03modlist.data.gz Going to write C:\Program Files\Perl\cpan\Metadata MIME::Base64 is up to date (3.07_01). Digest::MD5 is up to date (2.36_01). URI is up to date (1.37). Net::FTP is up to date (2.77). HTML::Tagset is up to date (3.20). HTML::Parser is up to date (3.56). HTML::HeadParser is up to date (2.22). LWP is up to date (5.814).

        Is there a clearcut manual way to install it including all the prerequisistes. I mean, where can I download a newer version from, I seem to have found only the present versionn in my searched

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://792742]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2015-07-05 09:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (61 votes), past polls