Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^4: LWP - 500 Internal Error

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


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

Hi,

yes, that particular link worked fine, 200 OK. What I meant to ask about was the error

Err : (9)(Bad file descriptor)(0)()

as the output of

my $err = sprintf "(%d)(%s)(%d)(%s)\n", $!,$!,$^E,$^E; print "Err : $err \n";

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

Really appreciate the feedback


Comment on Re^4: LWP - 500 Internal Error
Select or Download Code
Replies are listed 'Best First'.
Re^5: LWP - 500 Internal Error
by Anonymous Monk on Sep 01, 2009 at 21:41 UTC
    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"
      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.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2015-07-28 23:18 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 (260 votes), past polls