use strict; use warnings; use WWW::Mechanize; # LWP complains if this isn't included with the packaged executable. # This may be because I'm on Win32. At any rate, PP isn't smart enough # to know it's needed, so I include it here to make packaging easier. use Encode::Byte; # WWW::Mechanize debugging # per http://search.cpan.org/~mstrout/WWW-Mechanize/lib/WWW/Mechanize/FAQ.pod#How_do_I_figure_out_why_$mech-%3Eget%28$url%29_doesn%27t_work? use LWP::Debug qw(+); # by default, PP picks Net::SSLeay # It appears to test for IO::Socket::SSL first and use it if it's available. # use Crypt::SSLeay; # use IO::Socket::SSL; my $mech = WWW::Mechanize->new(); my $url = 'http://google.com'; $mech->get($url); if ($mech->success() == 1) { print "yay"; } else { die "Can't fetch $url"; }