1WWW::Mechanize(3)     User Contributed Perl Documentation    WWW::Mechanize(3)
2
3
4

NAME

6       WWW::Mechanize - Handy web browsing in a Perl object
7

VERSION

9       version 1.91
10

SYNOPSIS

12       WWW::Mechanize supports performing a sequence of page fetches including
13       following links and submitting forms. Each fetched page is parsed and
14       its links and forms are extracted. A link or a form can be selected,
15       form fields can be filled and the next page can be fetched.  Mech also
16       stores a history of the URLs you've visited, which can be queried and
17       revisited.
18
19           use WWW::Mechanize ();
20           my $mech = WWW::Mechanize->new();
21
22           $mech->get( $url );
23
24           $mech->follow_link( n => 3 );
25           $mech->follow_link( text_regex => qr/download this/i );
26           $mech->follow_link( url => 'http://host.com/index.html' );
27
28           $mech->submit_form(
29               form_number => 3,
30               fields      => {
31                   username    => 'mungo',
32                   password    => 'lost-and-alone',
33               }
34           );
35
36           $mech->submit_form(
37               form_name => 'search',
38               fields    => { query  => 'pot of gold', },
39               button    => 'Search Now'
40           );
41
42           # Enable strict form processing to catch typos and non-existant form fields.
43           my $strict_mech = WWW::Mechanize->new( strict_forms => 1);
44
45           $strict_mech->get( $url );
46
47           # This method call will die, saving you lots of time looking for the bug.
48           $strict_mech->submit_form(
49               form_number => 3,
50               fields      => {
51                   usernaem     => 'mungo',           # typo in field name
52                   password     => 'lost-and-alone',
53                   extra_field  => 123,               # field does not exist
54               }
55           );
56

DESCRIPTION

58       "WWW::Mechanize", or Mech for short, is a Perl module for stateful
59       programmatic web browsing, used for automating interaction with
60       websites.
61
62       Features include:
63
64       ·   All HTTP methods
65
66       ·   High-level hyperlink and HTML form support, without having to parse
67           HTML yourself
68
69       ·   SSL support
70
71       ·   Automatic cookies
72
73       ·   Custom HTTP headers
74
75       ·   Automatic handling of redirections
76
77       ·   Proxies
78
79       ·   HTTP authentication
80
81       Mech is well suited for use in testing web applications.  If you use
82       one of the Test::*, like Test::HTML::Lint modules, you can check the
83       fetched content and use that as input to a test call.
84
85           use Test::More;
86           like( $mech->content(), qr/$expected/, "Got expected content" );
87
88       Each page fetch stores its URL in a history stack which you can
89       traverse.
90
91           $mech->back();
92
93       If you want finer control over your page fetching, you can use these
94       methods. "follow_link" and "submit_form" are just high level wrappers
95       around them.
96
97           $mech->find_link( n => $number );
98           $mech->form_number( $number );
99           $mech->form_name( $name );
100           $mech->field( $name, $value );
101           $mech->set_fields( %field_values );
102           $mech->set_visible( @criteria );
103           $mech->click( $button );
104
105       WWW::Mechanize is a proper subclass of LWP::UserAgent and you can also
106       use any of LWP::UserAgent's methods.
107
108           $mech->add_header($name => $value);
109
110       Please note that Mech does NOT support JavaScript, you need additional
111       software for that. Please check "JavaScript" in WWW::Mechanize::FAQ for
112       more.
113
115       ·   <https://github.com/libwww-perl/WWW-Mechanize/issues>
116
117           The queue for bugs & enhancements in WWW::Mechanize.  Please note
118           that the queue at <http://rt.cpan.org> is no longer maintained.
119
120       ·   <https://metacpan.org/pod/WWW::Mechanize>
121
122           The CPAN documentation page for Mechanize.
123
124       ·   <https://metacpan.org/pod/distribution/WWW-Mechanize/lib/WWW/Mechanize/FAQ.pod>
125
126           Frequently asked questions.  Make sure you read here FIRST.
127

CONSTRUCTOR AND STARTUP

129   new()
130       Creates and returns a new WWW::Mechanize object, hereafter referred to
131       as the "agent".
132
133           my $mech = WWW::Mechanize->new()
134
135       The constructor for WWW::Mechanize overrides two of the parms to the
136       LWP::UserAgent constructor:
137
138           agent => 'WWW-Mechanize/#.##'
139           cookie_jar => {}    # an empty, memory-only HTTP::Cookies object
140
141       You can override these overrides by passing parms to the constructor,
142       as in:
143
144           my $mech = WWW::Mechanize->new( agent => 'wonderbot 1.01' );
145
146       If you want none of the overhead of a cookie jar, or don't want your
147       bot accepting cookies, you have to explicitly disallow it, like so:
148
149           my $mech = WWW::Mechanize->new( cookie_jar => undef );
150
151       Here are the parms that WWW::Mechanize recognizes.  These do not
152       include parms that LWP::UserAgent recognizes.
153
154       ·   "autocheck => [0|1]"
155
156           Checks each request made to see if it was successful.  This saves
157           you the trouble of manually checking yourself.  Any errors found
158           are errors, not warnings.
159
160           The default value is ON, unless it's being subclassed, in which
161           case it is OFF.  This means that standalone WWW::Mechanize
162           instances have autocheck turned on, which is protective for the
163           vast majority of Mech users who don't bother checking the return
164           value of get() and post() and can't figure why their code fails.
165           However, if WWW::Mechanize is subclassed, such as for
166           Test::WWW::Mechanize or Test::WWW::Mechanize::Catalyst, this may
167           not be an appropriate default, so it's off.
168
169       ·   "noproxy => [0|1]"
170
171           Turn off the automatic call to the LWP::UserAgent "env_proxy"
172           function.
173
174           This needs to be explicitly turned off if you're using
175           Crypt::SSLeay to access a https site via a proxy server.  Note: you
176           still need to set your HTTPS_PROXY environment variable as
177           appropriate.
178
179       ·   "onwarn => \&func"
180
181           Reference to a "warn"-compatible function, such as "Carp::carp",
182           that is called when a warning needs to be shown.
183
184           If this is set to "undef", no warnings will ever be shown.
185           However, it's probably better to use the "quiet" method to control
186           that behavior.
187
188           If this value is not passed, Mech uses "Carp::carp" if Carp is
189           installed, or "CORE::warn" if not.
190
191       ·   "onerror => \&func"
192
193           Reference to a "die"-compatible function, such as "Carp::croak",
194           that is called when there's a fatal error.
195
196           If this is set to "undef", no errors will ever be shown.
197
198           If this value is not passed, Mech uses "Carp::croak" if Carp is
199           installed, or "CORE::die" if not.
200
201       ·   "quiet => [0|1]"
202
203           Don't complain on warnings.  Setting "quiet => 1" is the same as
204           calling "$mech->quiet(1)".  Default is off.
205
206       ·   "stack_depth => $value"
207
208           Sets the depth of the page stack that keeps track of all the
209           downloaded pages. Default is effectively infinite stack size.  If
210           the stack is eating up your memory, then set this to a smaller
211           number, say 5 or 10.  Setting this to zero means Mech will keep no
212           history.
213
214       In addition, WWW::Mechanize also allows you to globally enable strict
215       and verbose mode for form handling, which is done with HTML::Form.
216
217       ·   "strict_forms => [0|1]"
218
219           Globally sets the HTML::Form strict flag which causes form
220           submission to croak if any of the passed fields don't exist in the
221           form, and/or a value doesn't exist in a select element. This can
222           still be disabled in individual calls to
223           "submit_form()|"$mech->submit_form( ... )"".
224
225           Default is off.
226
227       ·   "verbose_forms => [0|1]"
228
229           Globally sets the HTML::Form verbose flag which causes form
230           submission to warn about any bad HTML form constructs found. This
231           cannot be disabled later.
232
233           Default is off.
234
235       To support forms, WWW::Mechanize's constructor pushes POST on to the
236       agent's "requests_redirectable" list (see also LWP::UserAgent.)
237
238   $mech->agent_alias( $alias )
239       Sets the user agent string to the expanded version from a table of
240       actual user strings.  $alias can be one of the following:
241
242       ·   Windows IE 6
243
244       ·   Windows Mozilla
245
246       ·   Mac Safari
247
248       ·   Mac Mozilla
249
250       ·   Linux Mozilla
251
252       ·   Linux Konqueror
253
254       then it will be replaced with a more interesting one.  For instance,
255
256           $mech->agent_alias( 'Windows IE 6' );
257
258       sets your User-Agent to
259
260           Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
261
262       The list of valid aliases can be returned from "known_agent_aliases()".
263       The current list is:
264
265       ·   Windows IE 6
266
267       ·   Windows Mozilla
268
269       ·   Mac Safari
270
271       ·   Mac Mozilla
272
273       ·   Linux Mozilla
274
275       ·   Linux Konqueror
276
277   known_agent_aliases()
278       Returns a list of all the agent aliases that Mech knows about.
279

PAGE-FETCHING METHODS

281   $mech->get( $uri )
282       Given a URL/URI, fetches it.  Returns an HTTP::Response object.  $uri
283       can be a well-formed URL string, a URI object, or a
284       WWW::Mechanize::Link object.
285
286       The results are stored internally in the agent object, but you don't
287       know that.  Just use the accessors listed below.  Poking at the
288       internals is deprecated and subject to change in the future.
289
290       "get()" is a well-behaved overloaded version of the method in
291       LWP::UserAgent.  This lets you do things like
292
293           $mech->get( $uri, ':content_file' => $tempfile );
294
295       and you can rest assured that the parms will get filtered down
296       appropriately.
297
298       NOTE: Because ":content_file" causes the page contents to be stored in
299       a file instead of the response object, some Mech functions that expect
300       it to be there won't work as expected. Use with caution.
301
302   $mech->post( $uri, content => $content )
303       POSTs $content to $uri.  Returns an HTTP::Response object.  $uri can be
304       a well-formed URI string, a URI object, or a WWW::Mechanize::Link
305       object.
306
307   $mech->put( $uri, content => $content )
308       PUTs $content to $uri.  Returns an HTTP::Response object.  $uri can be
309       a well-formed URI string, a URI object, or a WWW::Mechanize::Link
310       object.
311
312   $mech->reload()
313       Acts like the reload button in a browser: repeats the current request.
314       The history (as per the back() method) is not altered.
315
316       Returns the HTTP::Response object from the reload, or "undef" if
317       there's no current request.
318
319   $mech->back()
320       The equivalent of hitting the "back" button in a browser.  Returns to
321       the previous page.  Won't go back past the first page. (Really, what
322       would it do if it could?)
323
324       Returns true if it could go back, or false if not.
325
326   $mech->clear_history()
327       This deletes all the history entries and returns true.
328
329   $mech->history_count()
330       This returns the number of items in the browser history.  This number
331       does include the most recently made request.
332
333   $mech->history($n)
334       This returns the nth item in history.  The 0th item is the most recent
335       request and response, which would be acted on by methods like
336       "find_link()".  The 1th item is the state you'd return to if you called
337       "back()".
338
339       The maximum useful value for $n is "$mech->history_count - 1".
340       Requests beyond that bound will return "undef".
341
342       History items are returned as hash references, in the form:
343
344         { req => $http_request, res => $http_response }
345

STATUS METHODS

347   $mech->success()
348       Returns a boolean telling whether the last request was successful.  If
349       there hasn't been an operation yet, returns false.
350
351       This is a convenience function that wraps "$mech->res->is_success".
352
353   $mech->uri()
354       Returns the current URI as a URI object. This object stringifies to the
355       URI itself.
356
357   $mech->response() / $mech->res()
358       Return the current response as an HTTP::Response object.
359
360       Synonym for "$mech->response()"
361
362   $mech->status()
363       Returns the HTTP status code of the response.  This is a 3-digit number
364       like 200 for OK, 404 for not found, and so on.
365
366   $mech->ct() / $mech->content_type()
367       Returns the content type of the response.
368
369   $mech->base()
370       Returns the base URI for the current response
371
372   $mech->forms()
373       When called in a list context, returns a list of the forms found in the
374       last fetched page. In a scalar context, returns a reference to an array
375       with those forms. The forms returned are all HTML::Form objects.
376
377   $mech->current_form()
378       Returns the current form as an HTML::Form object.
379
380   $mech->links()
381       When called in a list context, returns a list of the links found in the
382       last fetched page.  In a scalar context it returns a reference to an
383       array with those links.  Each link is a WWW::Mechanize::Link object.
384
385   $mech->is_html()
386       Returns true/false on whether our content is HTML, according to the
387       HTTP headers.
388
389   $mech->title()
390       Returns the contents of the "<TITLE>" tag, as parsed by
391       HTML::HeadParser.  Returns undef if the content is not HTML.
392

CONTENT-HANDLING METHODS

394   $mech->content(...)
395       Returns the content that the mech uses internally for the last page
396       fetched. Ordinarily this is the same as
397       "$mech->response()->decoded_content()", but this may differ for HTML
398       documents if update_html is overloaded (in which case the value passed
399       to the base-class implementation of same will be returned), and/or
400       extra named arguments are passed to content():
401
402       $mech->content( format => 'text' )
403         Returns a text-only version of the page, with all HTML markup
404         stripped. This feature requires HTML::TreeBuilder version 5 or higher
405         to be installed, or a fatal error will be thrown. This works only if
406         the contents are HTML.
407
408       $mech->content( base_href => [$base_href|undef] )
409         Returns the HTML document, modified to contain a "<base
410         href="$base_href">" mark-up in the header.  $base_href is
411         "$mech->base()" if not specified. This is handy to pass the HTML to
412         e.g. HTML::Display. This works only if the contents are HTML.
413
414       $mech->content( raw => 1 )
415         Returns "$self->response()->content()", i.e. the raw contents from
416         the response.
417
418       $mech->content( decoded_by_headers => 1 )
419         Returns the content after applying all "Content-Encoding" headers but
420         with not additional mangling.
421
422       $mech->content( charset => $charset )
423         Returns "$self->response()->decoded_content(charset => $charset)"
424         (see HTTP::Response for details).
425
426       To preserve backwards compatibility, additional parameters will be
427       ignored unless none of "raw | decoded_by_headers | charset" is
428       specified and the text is HTML, in which case an error will be
429       triggered.
430
431   $mech->text()
432       Returns the text of the current HTML content.  If the content isn't
433       HTML, $mech will die.
434
435       The text is extracted by parsing the content, and then the extracted
436       text is cached, so don't worry about performance of calling this
437       repeatedly.
438
440   $mech->links()
441       Lists all the links on the current page.  Each link is a
442       WWW::Mechanize::Link object. In list context, returns a list of all
443       links.  In scalar context, returns an array reference of all links.
444
445   $mech->follow_link(...)
446       Follows a specified link on the page.  You specify the match to be
447       found using the same parms that "find_link()" uses.
448
449       Here some examples:
450
451       ·   3rd link called "download"
452
453               $mech->follow_link( text => 'download', n => 3 );
454
455       ·   first link where the URL has "download" in it, regardless of case:
456
457               $mech->follow_link( url_regex => qr/download/i );
458
459           or
460
461               $mech->follow_link( url_regex => qr/(?i:download)/ );
462
463       ·   3rd link on the page
464
465               $mech->follow_link( n => 3 );
466
467       ·   the link with the url
468
469               $mech->follow_link( url => '/other/page' );
470
471           or
472
473               $mech->follow_link( url => 'http://example.com/page' );
474
475       Returns the result of the GET method (an HTTP::Response object) if a
476       link was found. If the page has no links, or the specified link
477       couldn't be found, returns undef.
478
479   $mech->find_link( ... )
480       Finds a link in the currently fetched page. It returns a
481       WWW::Mechanize::Link object which describes the link.  (You'll probably
482       be most interested in the "url()" property.)  If it fails to find a
483       link it returns undef.
484
485       You can take the URL part and pass it to the "get()" method.  If that's
486       your plan, you might as well use the "follow_link()" method directly,
487       since it does the "get()" for you automatically.
488
489       Note that "<FRAME SRC="...">" tags are parsed out of the the HTML and
490       treated as links so this method works with them.
491
492       You can select which link to find by passing in one or more of these
493       key/value pairs:
494
495       ·   "text => 'string'," and "text_regex => qr/regex/,"
496
497           "text" matches the text of the link against string, which must be
498           an exact match.  To select a link with text that is exactly
499           "download", use
500
501               $mech->find_link( text => 'download' );
502
503           "text_regex" matches the text of the link against regex.  To select
504           a link with text that has "download" anywhere in it, regardless of
505           case, use
506
507               $mech->find_link( text_regex => qr/download/i );
508
509           Note that the text extracted from the page's links are trimmed.
510           For example, "<a> foo </a>" is stored as 'foo', and searching for
511           leading or trailing spaces will fail.
512
513       ·   "url => 'string'," and "url_regex => qr/regex/,"
514
515           Matches the URL of the link against string or regex, as
516           appropriate.  The URL may be a relative URL, like foo/bar.html,
517           depending on how it's coded on the page.
518
519       ·   "url_abs => string" and "url_abs_regex => regex"
520
521           Matches the absolute URL of the link against string or regex, as
522           appropriate.  The URL will be an absolute URL, even if it's
523           relative in the page.
524
525       ·   "name => string" and "name_regex => regex"
526
527           Matches the name of the link against string or regex, as
528           appropriate.
529
530       ·   "id => string" and "id_regex => regex"
531
532           Matches the attribute 'id' of the link against string or regex, as
533           appropriate.
534
535       ·   "class => string" and "class_regex => regex"
536
537           Matches the attribute 'class' of the link against string or regex,
538           as appropriate.
539
540       ·   "tag => string" and "tag_regex => regex"
541
542           Matches the tag that the link came from against string or regex, as
543           appropriate.  The "tag_regex" is probably most useful to check for
544           more than one tag, as in:
545
546               $mech->find_link( tag_regex => qr/^(a|frame)$/ );
547
548           The tags and attributes looked at are defined below.
549
550       If "n" is not specified, it defaults to 1.  Therefore, if you don't
551       specify any parms, this method defaults to finding the first link on
552       the page.
553
554       Note that you can specify multiple text or URL parameters, which will
555       be ANDed together.  For example, to find the first link with text of
556       "News" and with "cnn.com" in the URL, use:
557
558           $mech->find_link( text => 'News', url_regex => qr/cnn\.com/ );
559
560       The return value is a reference to an array containing a
561       WWW::Mechanize::Link object for every link in "$self->content".
562
563       The links come from the following:
564
565       "<a href=...>"
566       "<area href=...>"
567       "<frame src=...>"
568       "<iframe src=...>"
569       "<link href=...>"
570       "<meta content=...>"
571
572   $mech->find_all_links( ... )
573       Returns all the links on the current page that match the criteria.  The
574       method for specifying link criteria is the same as in "find_link()".
575       Each of the links returned is a WWW::Mechanize::Link object.
576
577       In list context, "find_all_links()" returns a list of the links.
578       Otherwise, it returns a reference to the list of links.
579
580       "find_all_links()" with no parameters returns all links in the page.
581
582   $mech->find_all_inputs( ... criteria ... )
583       find_all_inputs() returns an array of all the input controls in the
584       current form whose properties match all of the regexes passed in.  The
585       controls returned are all descended from HTML::Form::Input.  See
586       "INPUTS" in HTML::Form for details.
587
588       If no criteria are passed, all inputs will be returned.
589
590       If there is no current page, there is no form on the current page, or
591       there are no submit controls in the current form then the return will
592       be an empty array.
593
594       You may use a regex or a literal string:
595
596           # get all textarea controls whose names begin with "customer"
597           my @customer_text_inputs = $mech->find_all_inputs(
598               type       => 'textarea',
599               name_regex => qr/^customer/,
600           );
601
602           # get all text or textarea controls called "customer"
603           my @customer_text_inputs = $mech->find_all_inputs(
604               type_regex => qr/^(text|textarea)$/,
605               name       => 'customer',
606           );
607
608   $mech->find_all_submits( ... criteria ... )
609       "find_all_submits()" does the same thing as "find_all_inputs()" except
610       that it only returns controls that are submit controls, ignoring other
611       types of input controls like text and checkboxes.
612

IMAGE METHODS

614   $mech->images
615       Lists all the images on the current page.  Each image is a
616       WWW::Mechanize::Image object. In list context, returns a list of all
617       images.  In scalar context, returns an array reference of all images.
618
619   $mech->find_image()
620       Finds an image in the current page. It returns a WWW::Mechanize::Image
621       object which describes the image.  If it fails to find an image it
622       returns undef.
623
624       You can select which image to find by passing in one or more of these
625       key/value pairs:
626
627       ·   "alt => 'string'" and "alt_regex => qr/regex/"
628
629           "alt" matches the ALT attribute of the image against string, which
630           must be an exact match. To select a image with an ALT tag that is
631           exactly "download", use
632
633               $mech->find_image( alt => 'download' );
634
635           "alt_regex" matches the ALT attribute of the image  against a
636           regular expression.  To select an image with an ALT attribute that
637           has "download" anywhere in it, regardless of case, use
638
639               $mech->find_image( alt_regex => qr/download/i );
640
641       ·   "url => 'string'" and "url_regex => qr/regex/"
642
643           Matches the URL of the image against string or regex, as
644           appropriate.  The URL may be a relative URL, like foo/bar.html,
645           depending on how it's coded on the page.
646
647       ·   "url_abs => string" and "url_abs_regex => regex"
648
649           Matches the absolute URL of the image against string or regex, as
650           appropriate.  The URL will be an absolute URL, even if it's
651           relative in the page.
652
653       ·   "tag => string" and "tag_regex => regex"
654
655           Matches the tag that the image came from against string or regex,
656           as appropriate.  The "tag_regex" is probably most useful to check
657           for more than one tag, as in:
658
659               $mech->find_image( tag_regex => qr/^(img|input)$/ );
660
661           The tags supported are "<img>" and "<input>".
662
663       ·   "id => string" and "id_regex => regex"
664
665           "id" matches the id attribute of the image against string, which
666           must be an exact match. To select an image with the exact id
667           "download-image", use
668
669               $mech->find_image( id => 'download-image' );
670
671           "id_regex" matches the id attribute of the image against a regular
672           expression. To select the first image with an id that contains
673           "download" anywhere in it, use
674
675               $mech->find_image( id_regex => qr/download/ );
676
677       ·   "classs => string" and "class_regex => regex"
678
679           "class" matches the class attribute of the image against string,
680           which must be an exact match. To select an image with the exact
681           class "img-fuid", use
682
683               $mech->find_image( class => 'img-fluid' );
684
685           To select an image with the class attribute "rounded float-left",
686           use
687
688               $mech->find_image( class => 'rounded float-left' );
689
690           Note that the classes have to be matched as a complete string, in
691           the exact order they appear in the website's source code.
692
693           "class_regex" matches the class attribute of the image against a
694           regular expression. Use this if you want a partial class name, or
695           if an image has several classes, but you only care about one.
696
697           To select the first image with the class "rounded", where there are
698           multiple images that might also have either class "float-left" or
699           "float-right", use
700
701               $mech->find_image( class_regex => qr/\brounded\b/ );
702
703           Selecting an image with multiple classes where you do not care
704           about the order they appear in the website's source code is not
705           currently supported.
706
707       If "n" is not specified, it defaults to 1.  Therefore, if you don't
708       specify any parms, this method defaults to finding the first image on
709       the page.
710
711       Note that you can specify multiple ALT or URL parameters, which will be
712       ANDed together.  For example, to find the first image with ALT text of
713       "News" and with "cnn.com" in the URL, use:
714
715           $mech->find_image( image => 'News', url_regex => qr/cnn\.com/ );
716
717       The return value is a reference to an array containing a
718       WWW::Mechanize::Image object for every image in "$self->content".
719
720   $mech->find_all_images( ... )
721       Returns all the images on the current page that match the criteria.
722       The method for specifying image criteria is the same as in
723       "find_image()".  Each of the images returned is a WWW::Mechanize::Image
724       object.
725
726       In list context, "find_all_images()" returns a list of the images.
727       Otherwise, it returns a reference to the list of images.
728
729       "find_all_images()" with no parameters returns all images in the page.
730

FORM METHODS

732       These methods let you work with the forms on a page.  The idea is to
733       choose a form that you'll later work with using the field methods
734       below.
735
736   $mech->forms
737       Lists all the forms on the current page.  Each form is an HTML::Form
738       object.  In list context, returns a list of all forms.  In scalar
739       context, returns an array reference of all forms.
740
741   $mech->form_number($number)
742       Selects the numberth form on the page as the target for subsequent
743       calls to "field()" and "click()".  Also returns the form that was
744       selected.
745
746       If it is found, the form is returned as an HTML::Form object and set
747       internally for later use with Mech's form methods such as "field()" and
748       "click()".  When called in a list context, the number of the found form
749       is also returned as a second value.
750
751       Emits a warning and returns undef if no form is found.
752
753       The first form is number 1, not zero.
754
755   $mech->form_name( $name )
756       Selects a form by name.  If there is more than one form on the page
757       with that name, then the first one is used, and a warning is generated.
758
759       If it is found, the form is returned as an HTML::Form object and set
760       internally for later use with Mech's form methods such as "field()" and
761       "click()".
762
763       Returns undef if no form is found.
764
765   $mech->form_id( $name )
766       Selects a form by ID.  If there is more than one form on the page with
767       that ID, then the first one is used, and a warning is generated.
768
769       If it is found, the form is returned as an HTML::Form object and set
770       internally for later use with Mech's form methods such as "field()" and
771       "click()".
772
773       If no form is found it returns "undef".  This will also trigger a
774       warning, unless "quiet" is enabled.
775
776   $mech->all_forms_with_fields( @fields )
777       Selects a form by passing in a list of field names it must contain.
778       All matching forms (perhaps none) are returned as a list of HTML::Form
779       objects.
780
781   $mech->form_with_fields( @fields )
782       Selects a form by passing in a list of field names it must contain.  If
783       there is more than one form on the page with that matches, then the
784       first one is used, and a warning is generated.
785
786       If it is found, the form is returned as an HTML::Form object and set
787       internally for later used with Mech's form methods such as "field()"
788       and "click()".
789
790       Returns undef and emits a warning if no form is found.
791
792       Note that this functionality requires libwww-perl 5.69 or higher.
793
794   $mech->all_forms_with( $attr1 => $value1, $attr2 => $value2, ... )
795       Searches for forms with arbitrary attribute/value pairs within the
796       <form> tag.  (Currently does not work for attribute "action" due to
797       implementation details of HTML::Form.)  When given more than one pair,
798       all criteria must match.  Using "undef" as value means that the
799       attribute in question may not be present.
800
801       All matching forms (perhaps none) are returned as a list of HTML::Form
802       objects.
803
804   $mech->form_with( $attr1 => $value1, $attr2 => $value2, ... )
805       Searches for forms with arbitrary attribute/value pairs within the
806       <form> tag.  (Currently does not work for attribute "action" due to
807       implementation details of HTML::Form.)  When given more than one pair,
808       all criteria must match.  Using "undef" as value means that the
809       attribute in question may not be present.
810
811       If it is found, the form is returned as an HTML::Form object and set
812       internally for later used with Mech's form methods such as "field()"
813       and "click()".
814
815       Returns undef if no form is found.
816

FIELD METHODS

818       These methods allow you to set the values of fields in a given form.
819
820   $mech->field( $name, $value, $number )
821   $mech->field( $name, \@values, $number )
822       Given the name of a field, set its value to the value specified.  This
823       applies to the current form (as set by the "form_name()" or
824       "form_number()" method or defaulting to the first form on the page).
825
826       The optional $number parameter is used to distinguish between two
827       fields with the same name.  The fields are numbered from 1.
828
829   $mech->select($name, $value)
830   $mech->select($name, \@values)
831       Given the name of a "select" field, set its value to the value
832       specified.  If the field is not "<select multiple>" and the $value is
833       an array, only the first value will be set.  [Note: the documentation
834       previously claimed that only the last value would be set, but this was
835       incorrect.]  Passing $value as a hash with an "n" key selects an item
836       by number (e.g.  "{n => 3}" or "{n => [2,4]}").  The numbering starts
837       at 1.  This applies to the current form.
838
839       If you have a field with "<select multiple>" and you pass a single
840       $value, then $value will be added to the list of fields selected,
841       without clearing the others.  However, if you pass an array reference,
842       then all previously selected values will be cleared.
843
844       Returns true on successfully setting the value. On failure, returns
845       false and calls "$self->warn()" with an error message.
846
847   $mech->set_fields( $name => $value ... )
848       This method sets multiple fields of the current form. It takes a list
849       of field name and value pairs. If there is more than one field with the
850       same name, the first one found is set. If you want to select which of
851       the duplicate field to set, use a value which is an anonymous array
852       which has the field value and its number as the 2 elements.
853
854               # set the second foo field
855               $mech->set_fields( $name => [ 'foo', 2 ] );
856
857       The fields are numbered from 1.
858
859       This applies to the current form.
860
861   $mech->set_visible( @criteria )
862       This method sets fields of the current form without having to know
863       their names.  So if you have a login screen that wants a username and
864       password, you do not have to fetch the form and inspect the source (or
865       use the mech-dump utility, installed with WWW::Mechanize) to see what
866       the field names are; you can just say
867
868           $mech->set_visible( $username, $password );
869
870       and the first and second fields will be set accordingly.  The method is
871       called set_visible because it acts only on visible fields; hidden form
872       inputs are not considered.  The order of the fields is the order in
873       which they appear in the HTML source which is nearly always the order
874       anyone viewing the page would think they are in, but some creative work
875       with tables could change that; caveat user.
876
877       Each element in @criteria is either a field value or a field specifier.
878       A field value is a scalar.  A field specifier allows you to specify the
879       type of input field you want to set and is denoted with an arrayref
880       containing two elements.  So you could specify the first radio button
881       with
882
883           $mech->set_visible( [ radio => 'KCRW' ] );
884
885       Field values and specifiers can be intermixed, hence
886
887           $mech->set_visible( 'fred', 'secret', [ option => 'Checking' ] );
888
889       would set the first two fields to "fred" and "secret", and the next
890       "OPTION" menu field to "Checking".
891
892       The possible field specifier types are: "text", "password", "hidden",
893       "textarea", "file", "image", "submit", "radio", "checkbox" and
894       "option".
895
896       "set_visible" returns the number of values set.
897
898   $mech->tick( $name, $value [, $set] )
899       "Ticks" the first checkbox that has both the name and value associated
900       with it on the current form.  Dies if there is no named check box for
901       that value.  Passing in a false value as the third optional argument
902       will cause the checkbox to be unticked.
903
904   $mech->untick($name, $value)
905       Causes the checkbox to be unticked.  Shorthand for
906       "tick($name,$value,undef)"
907
908   $mech->value( $name [, $number] )
909       Given the name of a field, return its value. This applies to the
910       current form.
911
912       The optional $number parameter is used to distinguish between two
913       fields with the same name.  The fields are numbered from 1.
914
915       If the field is of type file (file upload field), the value is always
916       cleared to prevent remote sites from downloading your local files.  To
917       upload a file, specify its file name explicitly.
918
919   $mech->click( $button [, $x, $y] )
920       Has the effect of clicking a button on the current form.  The first
921       argument is the name of the button to be clicked.  The second and third
922       arguments (optional) allow you to specify the (x,y) coordinates of the
923       click.
924
925       If there is only one button on the form, "$mech->click()" with no
926       arguments simply clicks that one button.
927
928       Returns an HTTP::Response object.
929
930   $mech->click_button( ... )
931       Has the effect of clicking a button on the current form by specifying
932       its name, value, or index.  Its arguments are a list of key/value
933       pairs.  Only one of name, number, input or value must be specified in
934       the keys.
935
936       ·   "name => name"
937
938           Clicks the button named name in the current form.
939
940       ·   "id => id"
941
942           Clicks the button with the id id in the current form.
943
944       ·   "number => n"
945
946           Clicks the nth button in the current form. Numbering starts at 1.
947
948       ·   "value => value"
949
950           Clicks the button with the value value in the current form.
951
952       ·   "input => $inputobject"
953
954           Clicks on the button referenced by $inputobject, an instance of
955           HTML::Form::SubmitInput obtained e.g. from
956
957               $mech->current_form()->find_input( undef, 'submit' )
958
959           $inputobject must belong to the current form.
960
961       ·   "x => x"
962
963       ·   "y => y"
964
965           These arguments (optional) allow you to specify the (x,y)
966           coordinates of the click.
967
968   $mech->submit()
969       Submits the current form, without specifying a button to click.
970       Actually, no button is clicked at all.
971
972       Returns an HTTP::Response object.
973
974       This used to be a synonym for "$mech->click( 'submit' )", but is no
975       longer so.
976
977   $mech->submit_form( ... )
978       This method lets you select a form from the previously fetched page,
979       fill in its fields, and submit it. It combines the
980       "form_number"/"form_name", "set_fields" and "click" methods into one
981       higher level call. Its arguments are a list of key/value pairs, all of
982       which are optional.
983
984       ·   "fields => \%fields"
985
986           Specifies the fields to be filled in the current form.
987
988       ·   "with_fields => \%fields"
989
990           Probably all you need for the common case. It combines a smart form
991           selector and data setting in one operation. It selects the first
992           form that contains all fields mentioned in "\%fields".  This is
993           nice because you don't need to know the name or number of the form
994           to do this.
995
996           (calls "form_with_fields()" and "set_fields()").
997
998           If you choose "with_fields", the "fields" option will be ignored.
999           The "form_number", "form_name" and "form_id" options will still be
1000           used.  An exception will be thrown unless exactly one form matches
1001           all of the provided criteria.
1002
1003       ·   "form_number => n"
1004
1005           Selects the nth form (calls "form_number()".  If this parm is not
1006           specified, the currently-selected form is used.
1007
1008       ·   "form_name => name"
1009
1010           Selects the form named name (calls "form_name()")
1011
1012       ·   "form_id => ID"
1013
1014           Selects the form with ID ID (calls "form_id()")>>)
1015
1016       ·   "button => button"
1017
1018           Clicks on button button (calls "click()")
1019
1020       ·   "x => x, y => y"
1021
1022           Sets the x or y values for "click()"
1023
1024       ·   "strict_forms => bool"
1025
1026           Sets the HTML::Form strict flag which causes form submission to
1027           croak if any of the passed fields don't exist on the page, and/or a
1028           value doesn't exist in a select element.  By default HTML::Form
1029           sets this value to false.
1030
1031           This behavior can also be turned on globally by passing
1032           "strict_forms => 1" to "WWW::Mechanize->new". If you do that, you
1033           can still disable it for individual calls by passing "strict_forms
1034           => 0" here.
1035
1036       If no form is selected, the first form found is used.
1037
1038       If button is not passed, then the "submit()|"$mech->submit()"" method
1039       is used instead.
1040
1041       If you want to submit a file and get its content from a scalar rather
1042       than a file in the filesystem, you can use:
1043
1044           $mech->submit_form(with_fields => { logfile => [ [ undef, 'whatever', Content => $content ], 1 ] } );
1045
1046       Returns an HTTP::Response object.
1047

MISCELLANEOUS METHODS

1049   $mech->add_header( name => $value [, name => $value... ] )
1050       Sets HTTP headers for the agent to add or remove from the HTTP request.
1051
1052           $mech->add_header( Encoding => 'text/klingon' );
1053
1054       If a value is "undef", then that header will be removed from any future
1055       requests.  For example, to never send a Referer header:
1056
1057           $mech->add_header( Referer => undef );
1058
1059       If you want to delete a header, use "delete_header".
1060
1061       Returns the number of name/value pairs added.
1062
1063       NOTE: This method was very different in WWW::Mechanize before 1.00.
1064       Back then, the headers were stored in a package hash, not as a member
1065       of the object instance.  Calling "add_header()" would modify the
1066       headers for every WWW::Mechanize object, even after your object no
1067       longer existed.
1068
1069   $mech->delete_header( name [, name ... ] )
1070       Removes HTTP headers from the agent's list of special headers.  For
1071       instance, you might need to do something like:
1072
1073           # Don't send a Referer for this URL
1074           $mech->add_header( Referer => undef );
1075
1076           # Get the URL
1077           $mech->get( $url );
1078
1079           # Back to the default behavior
1080           $mech->delete_header( 'Referer' );
1081
1082   $mech->quiet(true/false)
1083       Allows you to suppress warnings to the screen.
1084
1085           $mech->quiet(0); # turns on warnings (the default)
1086           $mech->quiet(1); # turns off warnings
1087           $mech->quiet();  # returns the current quietness status
1088
1089   $mech->stack_depth( $max_depth )
1090       Get or set the page stack depth. Use this if you're doing a lot of page
1091       scraping and running out of memory.
1092
1093       A value of 0 means "no history at all."  By default, the max stack
1094       depth is humongously large, effectively keeping all history.
1095
1096   $mech->save_content( $filename, %opts )
1097       Dumps the contents of "$mech->content" into $filename.  $filename will
1098       be overwritten.  Dies if there are any errors.
1099
1100       If the content type does not begin with "text/", then the content is
1101       saved in binary mode (i.e. "binmode()" is set on the output
1102       filehandle).
1103
1104       Additional arguments can be passed as key/value pairs:
1105
1106       $mech->save_content( $filename, binary => 1 )
1107           Filehandle is set with "binmode" to ":raw" and contents are taken
1108           calling "$self->content(decoded_by_headers => 1)". Same as calling:
1109
1110               $mech->save_content( $filename, binmode => ':raw',
1111                                    decoded_by_headers => 1 );
1112
1113           This should be the safest way to save contents verbatim.
1114
1115       $mech->save_content( $filename, binmode => $binmode )
1116           Filehandle is set to binary mode. If $binmode begins with ':', it
1117           is passed as a parameter to "binmode":
1118
1119               binmode $fh, $binmode;
1120
1121           otherwise the filehandle is set to binary mode if $binmode is true:
1122
1123               binmode $fh;
1124
1125       all other arguments
1126           are passed as-is to "$mech->content(%opts)". In particular,
1127           "decoded_by_headers" might come handy if you want to revert the
1128           effect of line compression performed by the web server but without
1129           further interpreting the contents (e.g. decoding it according to
1130           the charset).
1131
1132   $mech->dump_headers( [$fh] )
1133       Prints a dump of the HTTP response headers for the most recent
1134       response.  If $fh is not specified or is undef, it dumps to STDOUT.
1135
1136       Unlike the rest of the dump_* methods, $fh can be a scalar. It will be
1137       used as a file name.
1138
1139   $mech->dump_links( [[$fh], $absolute] )
1140       Prints a dump of the links on the current page to $fh.  If $fh is not
1141       specified or is undef, it dumps to STDOUT.
1142
1143       If $absolute is true, links displayed are absolute, not relative.
1144
1145   $mech->dump_images( [[$fh], $absolute] )
1146       Prints a dump of the images on the current page to $fh.  If $fh is not
1147       specified or is undef, it dumps to STDOUT.
1148
1149       If $absolute is true, links displayed are absolute, not relative.
1150
1151   $mech->dump_forms( [$fh] )
1152       Prints a dump of the forms on the current page to $fh.  If $fh is not
1153       specified or is undef, it dumps to STDOUT. Running the following:
1154
1155           my $mech = WWW::Mechanize->new();
1156           $mech->get("https://www.google.com/");
1157           $mech->dump_forms;
1158
1159       will print:
1160
1161           GET https://www.google.com/search [f]
1162             ie=ISO-8859-1                  (hidden readonly)
1163             hl=en                          (hidden readonly)
1164             source=hp                      (hidden readonly)
1165             biw=                           (hidden readonly)
1166             bih=                           (hidden readonly)
1167             q=                             (text)
1168             btnG=Google Search             (submit)
1169             btnI=I'm Feeling Lucky         (submit)
1170             gbv=1                          (hidden readonly)
1171
1172   $mech->dump_text( [$fh] )
1173       Prints a dump of the text on the current page to $fh.  If $fh is not
1174       specified or is undef, it dumps to STDOUT.
1175

OVERRIDDEN LWP::UserAgent METHODS

1177   $mech->clone()
1178       Clone the mech object.  The clone will be using the same cookie jar as
1179       the original mech.
1180
1181   $mech->redirect_ok()
1182       An overloaded version of "redirect_ok()" in LWP::UserAgent.  This
1183       method is used to determine whether a redirection in the request should
1184       be followed.
1185
1186       Note that WWW::Mechanize's constructor pushes POST on to the agent's
1187       "requests_redirectable" list.
1188
1189   $mech->request( $request [, $arg [, $size]])
1190       Overloaded version of "request()" in LWP::UserAgent.  Performs the
1191       actual request.  Normally, if you're using WWW::Mechanize, it's because
1192       you don't want to deal with this level of stuff anyway.
1193
1194       Note that $request will be modified.
1195
1196       Returns an HTTP::Response object.
1197
1198   $mech->update_html( $html )
1199       Allows you to replace the HTML that the mech has found.  Updates the
1200       forms and links parse-trees that the mech uses internally.
1201
1202       Say you have a page that you know has malformed output, and you want to
1203       update it so the links come out correctly:
1204
1205           my $html = $mech->content;
1206           $html =~ s[</option>.{0,3}</td>][</option></select></td>]isg;
1207           $mech->update_html( $html );
1208
1209       This method is also used internally by the mech itself to update its
1210       own HTML content when loading a page. This means that if you would like
1211       to systematically perform the above HTML substitution, you would
1212       overload update_html in a subclass thusly:
1213
1214          package MyMech;
1215          use base 'WWW::Mechanize';
1216
1217          sub update_html {
1218              my ($self, $html) = @_;
1219              $html =~ s[</option>.{0,3}</td>][</option></select></td>]isg;
1220              $self->WWW::Mechanize::update_html( $html );
1221          }
1222
1223       If you do this, then the mech will use the tidied-up HTML instead of
1224       the original both when parsing for its own needs, and for returning to
1225       you through "content".
1226
1227       Overloading this method is also the recommended way of implementing
1228       extra validation steps (e.g. link checkers) for every HTML page
1229       received.  "warn" and "die" would then come in handy to signal
1230       validation errors.
1231
1232   $mech->credentials( $username, $password )
1233       Provide credentials to be used for HTTP Basic authentication for all
1234       sites and realms until further notice.
1235
1236       The four argument form described in LWP::UserAgent is still supported.
1237
1238   $mech->get_basic_credentials( $realm, $uri, $isproxy )
1239       Returns the credentials for the realm and URI.
1240
1241   $mech->clear_credentials()
1242       Remove any credentials set up with "credentials()".
1243

INHERITED UNCHANGED LWP::UserAgent METHODS

1245       As a subclass of LWP::UserAgent, WWW::Mechanize inherits all of
1246       LWP::UserAgent's methods.  Many of which are overridden or extended.
1247       The following methods are inherited unchanged. View the LWP::UserAgent
1248       documentation for their implementation descriptions.
1249
1250       This is not meant to be an inclusive list.  LWP::UA may have added
1251       others.
1252
1253   $mech->head()
1254       Inherited from LWP::UserAgent.
1255
1256   $mech->mirror()
1257       Inherited from LWP::UserAgent.
1258
1259   $mech->simple_request()
1260       Inherited from LWP::UserAgent.
1261
1262   $mech->is_protocol_supported()
1263       Inherited from LWP::UserAgent.
1264
1265   $mech->prepare_request()
1266       Inherited from LWP::UserAgent.
1267
1268   $mech->progress()
1269       Inherited from LWP::UserAgent.
1270

INTERNAL-ONLY METHODS

1272       These methods are only used internally.  You probably don't need to
1273       know about them.
1274
1275   $mech->_update_page($request, $response)
1276       Updates all internal variables in $mech as if $request was just
1277       performed, and returns $response. The page stack is not altered by this
1278       method, it is up to caller (e.g.  "request") to do that.
1279
1280   $mech->_modify_request( $req )
1281       Modifies a HTTP::Request before the request is sent out, for both GET
1282       and POST requests.
1283
1284       We add a "Referer" header, as well as header to note that we can accept
1285       gzip encoded content, if Compress::Zlib is installed.
1286
1287   $mech->_make_request()
1288       Convenience method to make it easier for subclasses like
1289       WWW::Mechanize::Cached to intercept the request.
1290
1291   $mech->_reset_page()
1292       Resets the internal fields that track page parsed stuff.
1293
1294   $mech->_extract_links()
1295       Extracts links from the content of a webpage, and populates the
1296       "{links}" property with WWW::Mechanize::Link objects.
1297
1298   $mech->_push_page_stack()
1299       The agent keeps a stack of visited pages, which it can pop when it
1300       needs to go BACK and so on.
1301
1302       The current page needs to be pushed onto the stack before we get a new
1303       page, and the stack needs to be popped when BACK occurs.
1304
1305       Neither of these take any arguments, they just operate on the $mech
1306       object.
1307
1308   warn( @messages )
1309       Centralized warning method, for diagnostics and non-fatal problems.
1310       Defaults to calling "CORE::warn", but may be overridden by setting
1311       "onwarn" in the constructor.
1312
1313   die( @messages )
1314       Centralized error method.  Defaults to calling "CORE::die", but may be
1315       overridden by setting "onerror" in the constructor.
1316

BEST PRACTICES

1318       The default settings can get you up and running quickly, but there are
1319       settings you can change in order to make your life easier.
1320
1321       autocheck
1322           "autocheck" can save you the overhead of checking status codes for
1323           success.  You may outgrow it as your needs get more sophisticated,
1324           but it's a safe option to start with.
1325
1326               my $agent = WWW::Mechanize->new( autocheck => 1 );
1327
1328       cookie_jar
1329           You are encouraged to install Mozilla::PublicSuffix and use
1330           HTTP::CookieJar::LWP as your cookie jar.  HTTP::CookieJar::LWP
1331           provides a better security model matching that of current Web
1332           browsers when Mozilla::PublicSuffix is installed.
1333
1334               use HTTP::CookieJar::LWP ();
1335
1336               my $jar = HTTP::CookieJar::LWP->new;
1337               my $agent = WWW::Mechanize->new( cookie_jar => $jar );
1338
1339       protocols_allowed
1340           This option is inherited directly from LWP::UserAgent.  It allows
1341           you to whitelist the protocols you're willing to allow.
1342
1343               my $agent = WWW::Mechanize->new(
1344                   protocols_allowed => [ 'http', 'https' ]
1345               );
1346
1347           This will prevent you from inadvertently following URLs like
1348           "file:///etc/passwd"
1349
1350       protocols_forbidden
1351           This option is also inherited directly from LWP::UserAgent.  It
1352           allows you to blacklist the protocols you're unwilling to allow.
1353
1354               my $agent = WWW::Mechanize->new(
1355                   protocols_forbidden => [ 'file', 'mailto', 'ssh', ]
1356               );
1357
1358           This will prevent you from inadvertently following URLs like
1359           "file:///etc/passwd"
1360
1361       strict_forms
1362           Consider turning on the "strict_forms" option when you create a new
1363           Mech.  This will perform a helpful sanity check on form fields
1364           every time you are submitting a form, which can save you a lot of
1365           debugging time.
1366
1367               my $agent = WWW::Mechanize->new( strict_forms => 1 );
1368
1369           If you do not want to have this option globally, you can still turn
1370           it on for individual forms.
1371
1372               $agent->submit_form( fields => { foo => 'bar' } , strict_forms => 1 );
1373

WWW::MECHANIZE'S GIT REPOSITORY

1375       WWW::Mechanize is hosted at GitHub.
1376
1377       Repository: <https://github.com/libwww-perl/WWW-Mechanize>.  Bugs:
1378       <https://github.com/libwww-perl/WWW-Mechanize/issues>.
1379

OTHER DOCUMENTATION

1381   Spidering Hacks, by Kevin Hemenway and Tara Calishain
1382       Spidering Hacks from O'Reilly
1383       (<http://www.oreilly.com/catalog/spiderhks/>) is a great book for
1384       anyone wanting to know more about screen-scraping and spidering.
1385
1386       There are six hacks that use Mech or a Mech derivative:
1387
1388       #21 WWW::Mechanize 101
1389       #22 Scraping with WWW::Mechanize
1390       #36 Downloading Images from Webshots
1391       #44 Archiving Yahoo! Groups Messages with WWW::Yahoo::Groups
1392       #64 Super Author Searching
1393       #73 Scraping TV Listings
1394
1395       The book was also positively reviewed on Slashdot:
1396       <http://books.slashdot.org/article.pl?sid=03/12/11/2126256>
1397

ONLINE RESOURCES AND SUPPORT

1399       ·   WWW::Mechanize mailing list
1400
1401           The Mech mailing list is at
1402           <http://groups.google.com/group/www-mechanize-users> and is
1403           specific to Mechanize, unlike the LWP mailing list below.  Although
1404           it is a users list, all development discussion takes place here,
1405           too.
1406
1407       ·   LWP mailing list
1408
1409           The LWP mailing list is at
1410           <http://lists.perl.org/showlist.cgi?name=libwww>, and is more user-
1411           oriented and well-populated than the WWW::Mechanize list.
1412
1413       ·   Perlmonks
1414
1415           <http://perlmonks.org> is an excellent community of support, and
1416           many questions about Mech have already been answered there.
1417
1418       ·   WWW::Mechanize::Examples
1419
1420           A random array of examples submitted by users, included with the
1421           Mechanize distribution.
1422

ARTICLES ABOUT WWW::MECHANIZE

1424       ·   <http://www.ibm.com/developerworks/linux/library/wa-perlsecure/>
1425
1426           IBM article "Secure Web site access with Perl"
1427
1428       ·   <http://www.oreilly.com/catalog/googlehks2/chapter/hack84.pdf>
1429
1430           Leland Johnson's hack #84 in Google Hacks, 2nd Edition is an
1431           example of a production script that uses WWW::Mechanize and
1432           HTML::TableContentParser. It takes in keywords and returns the
1433           estimated price of these keywords on Google's AdWords program.
1434
1435       ·   <http://www.perl.com/pub/a/2004/06/04/recorder.html>
1436
1437           Linda Julien writes about using HTTP::Recorder to create
1438           WWW::Mechanize scripts.
1439
1440       ·   <http://www.developer.com/lang/other/article.php/3454041>
1441
1442           Jason Gilmore's article on using WWW::Mechanize for scraping sales
1443           information from Amazon and eBay.
1444
1445       ·   <http://www.perl.com/pub/a/2003/01/22/mechanize.html>
1446
1447           Chris Ball's article about using WWW::Mechanize for scraping TV
1448           listings.
1449
1450       ·   <http://www.stonehenge.com/merlyn/LinuxMag/col47.html>
1451
1452           Randal Schwartz's article on scraping Yahoo News for images.  It's
1453           already out of date: He manually walks the list of links hunting
1454           for matches, which wouldn't have been necessary if the
1455           "find_link()" method existed at press time.
1456
1457       ·   <http://www.perladvent.org/2002/16th/>
1458
1459           WWW::Mechanize on the Perl Advent Calendar, by Mark Fowler.
1460
1461       ·   <http://www.linux-magazin.de/ausgaben/2004/03/datenruessel/>
1462
1463           Michael Schilli's article on Mech and WWW::Mechanize::Shell for the
1464           German magazine Linux Magazin.
1465
1466   Other modules that use Mechanize
1467       Here are modules that use or subclass Mechanize.  Let me know of any
1468       others:
1469
1470       ·   Finance::Bank::LloydsTSB
1471
1472       ·   HTTP::Recorder
1473
1474           Acts as a proxy for web interaction, and then generates
1475           WWW::Mechanize scripts.
1476
1477       ·   Win32::IE::Mechanize
1478
1479           Just like Mech, but using Microsoft Internet Explorer to do the
1480           work.
1481
1482       ·   WWW::Bugzilla
1483
1484       ·   WWW::CheckSite
1485
1486       ·   WWW::Google::Groups
1487
1488       ·   WWW::Hotmail
1489
1490       ·   WWW::Mechanize::Cached
1491
1492       ·   WWW::Mechanize::Cached::GZip
1493
1494       ·   WWW::Mechanize::FormFiller
1495
1496       ·   WWW::Mechanize::Shell
1497
1498       ·   WWW::Mechanize::Sleepy
1499
1500       ·   WWW::Mechanize::SpamCop
1501
1502       ·   WWW::Mechanize::Timed
1503
1504       ·   WWW::SourceForge
1505
1506       ·   WWW::Yahoo::Groups
1507
1508       ·   WWW::Scripter
1509

ACKNOWLEDGEMENTS

1511       Thanks to the numerous people who have helped out on WWW::Mechanize in
1512       one way or another, including Kirrily Robert for the original
1513       "WWW::Automate", Lyle Hopkins, Damien Clark, Ansgar Burchardt, Gisle
1514       Aas, Jeremy Ary, Hilary Holz, Rafael Kitover, Norbert Buchmuller, Dave
1515       Page, David Sainty, H.Merijn Brand, Matt Lawrence, Michael Schwern,
1516       Adriano Ferreira, Miyagawa, Peteris Krumins, Rafael Kitover, David
1517       Steinbrunner, Kevin Falcone, Mike O'Regan, Mark Stosberg, Uri Guttman,
1518       Peter Scott, Philippe Bruhat, Ian Langworth, John Beppu, Gavin Estey,
1519       Jim Brandt, Ask Bjoern Hansen, Greg Davies, Ed Silva, Mark-Jason
1520       Dominus, Autrijus Tang, Mark Fowler, Stuart Children, Max Maischein,
1521       Meng Wong, Prakash Kailasa, Abigail, Jan Pazdziora, Dominique
1522       Quatravaux, Scott Lanning, Rob Casey, Leland Johnson, Joshua Gatcomb,
1523       Julien Beasley, Abe Timmerman, Peter Stevens, Pete Krawczyk, Tad
1524       McClellan, and the late great Iain Truskett.
1525

AUTHOR

1527       Andy Lester <andy at petdance.com>
1528
1530       This software is copyright (c) 2004-2016 by Andy Lester.
1531
1532       This is free software; you can redistribute it and/or modify it under
1533       the same terms as the Perl 5 programming language system itself.
1534
1535
1536
1537perl v5.30.0                      2019-07-26                 WWW::Mechanize(3)
Impressum