in reply to Where is LWP::Simple::get error information stored?

Sadly it isn't stored anywhere, even LWP::UserAgent itself doesn't store that stuff, it forces you to store it

WWW::Mechanize on the other hand stores the responses so you don't have to, it even (optionally, by default ) throws exceptions

  • Comment on Re: Where is LWP::Simple::get error information stored?

Replies are listed 'Best First'.
Re^2: Where is LWP::Simple::get error information stored?
by ajam (Acolyte) on Sep 28, 2012 at 01:40 UTC

    Thanks for the information. I will look into WWW::Mechanize.

Re^2: Where is LWP::Simple::get error information stored?
by Anonymous Monk on Sep 28, 2012 at 13:36 UTC

    LWP::UserAgent doesn't?

    use LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->env_proxy; my $response = $ua->get('http://example.org/'); print "HTTP response code was: ", $response->status_line, "\n"; #print "Content was:\n", $response->content, "\n";
    HTTP response code was: 200 OK HTTP response code was: 404 Not Found HTTP response code was: 500 Can't connect to 127.0.0.1:80 (Invalid arg +ument)

      Of course it doesn't, it forces you to store it

      my $response = $ua->get('http://example.org/');

        Oh, and it forces you to store the content, too? How inconvenient!