LWP::UserAgentを使ってみる

UserAgentとRefererを設定して診断君を取得する
参考リンク
http://search.cpan.org/~gaas/libwww-perl-5.836/lib/LWP/UserAgent.pm

#!/usr/local/bin/perl
use LWP::UserAgent;
use HTTP::Headers;
use feature qw(say);
$ua = LWP::UserAgent->new (
timeout => 5,
agent => 'Mozilla/5.0 (Windows; U; Windows NT 6.0; ja; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)'
);


$ua->default_header(
'Referer' => "hoge",
'Accept-Language' => "no, en");
$res=$ua->get('http://taruo.net/e/');
if ($res->is_success){
say $res->code;
say $res->message;
say $res->content;
}