Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^2: problem w/ LWP::UserAgent?

by dorianwinterfeld (Acolyte)
on May 30, 2013 at 13:43 UTC ( #1036050=note: print w/replies, xml ) Need Help??

in reply to Re: problem w/ LWP::UserAgent?
in thread problem w/ LWP::UserAgent?

Thanks for your quick reply Derby. The script does use LWP::UserAgent. Here is my stripped down test script:
use CGI qw/:standard/; use CGI::Carp (fatalsToBrowser); require LWP::UserAgent; print header; my $ua = LWP::UserAgent->new; my $url = ''; my $response = $ua->get($url); if ($response->is_success) { print $response->decoded_content; # or whatever } else { die "failed: $url : ", $response->status_line; }
So, it's dying w/ Status code 500. The server logs don't say much: "GET /scripts/prince/lwp_test.plx - 200 Mozilla/5.0+(compatible;+MSIE+10.0;+Windows+NT+6.1;+WOW64;+Trident/6.0;+EIE10;ENUSWOL)" I have run this script on two different servers, after the Perl upgrade on both, and I get the same error message.

Replies are listed 'Best First'.
Re^3: problem w/ LWP::UserAgent?
by derby (Abbot) on May 30, 2013 at 14:33 UTC

    Is it really throwing the error with the google url or was that just a change for posting? What happens if you run the above script from the command line? Do you still get the 500? The 500 error *should* be from the server the url points to and I have a hard time believing google is throwing a 500.

    The only *recent* LWP upgrade issue that I can think of is the SSL validity check on https -- but that would throw an entirely different error I believe.

      The only *recent* LWP upgrade issue that I can think of is the SSL validity check on https
      After this (after 6.x) there were updates related to socket stuff.
Re^3: problem w/ LWP::UserAgent?
by vsespb (Chaplain) on May 30, 2013 at 15:48 UTC
    Could you run it with
    print $response->dump;
    (in case of failure) and paste output here?

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2022-06-29 06:43 GMT
Find Nodes?
    Voting Booth?
    My most frequent journeys are powered by:

    Results (94 votes). Check out past polls.