あらすじは次のように述べています。
WWW::MechanizeはLWP::UserAgentの適切なサブクラスであり、 LWP:: UserAgentの任意のメソッドを使用することもできます。
use strict;
use warnings;
use WWW::Mechanize;
my $mech = WWW::Mechanize->new();
$mech->get( 'http://www.example.com' );
print $mech->dump_headers();
print " \n ==OR== \n\n";
my $header = HTTP::Request->new(GET => 'http://www.example.com');
my $request = HTTP::Request->new('GET', 'http://www.example.com', $header);
my $response = $mech->request($request);
print $response->headers_as_string;
版画:
Connection: close
Date: Wed, 26 Jun 2013 03:57:01 GMT
Accept-Ranges: bytes
ETag: "780602-4f6-4db31b2978ec0"
Server: ECS (mdw/13C6)
Content-Length: 1270
Content-Type: text/html; charset=UTF-8
Last-Modified: Thu, 25 Apr 2013 16:13:23 GMT
Client-Date: Wed, 26 Jun 2013 03:57:01 GMT
Client-Peer: 93.184.216.119:80
Client-Response-Num: 1
Title: Example Domain
X-Cache: HIT
X-Meta-Charset: utf-8
X-Meta-Viewport: width=device-width, initial-scale=1
==OR==
Connection: close
Date: Wed, 26 Jun 2013 03:57:01 GMT
Accept-Ranges: bytes
ETag: "780602-4f6-4db31b2978ec0"
Server: ECS (mdw/13C6)
Content-Length: 1270
Content-Type: text/html; charset=UTF-8
Last-Modified: Thu, 25 Apr 2013 16:13:23 GMT
Client-Date: Wed, 26 Jun 2013 03:57:01 GMT
Client-Peer: 93.184.216.119:80
Client-Response-Num: 1
Title: Example Domain
X-Cache: HIT
X-Meta-Charset: utf-8
X-Meta-Viewport: width=device-width, initial-scale=1