http://qs321.pair.com?node_id=1095543


in reply to LWP::UserAgent error Unexpected keys - LocalHost

Here's a slightly modified script that worked on my versions of perl from 5.8.8 thru 5.20.0. Note: Always use strictures.
#!/usr/bin/perl -l use strict; use warnings; require LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->agent("Mozilla/8.0"); $ua->cookie_jar( { file => 'mycookies.txt', autosave => 1 } ); my $url = 'http://www.perlmeme.org/'; my $req = HTTP::Request->new( 'GET', $url ); my $res = $ua->request( $req, undef, undef ) || die( 'Get'->Bad ); if ( $res->is_success ) { print $res->decoded_content; } else { print ">> ", $res->status_line; }