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.95
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 "submit_form()".
223
224           Default is off.
225
226       ·   "verbose_forms => [0|1]"
227
228           Globally sets the HTML::Form verbose flag which causes form
229           submission to warn about any bad HTML form constructs found. This
230           cannot be disabled later.
231
232           Default is off.
233
234       To support forms, WWW::Mechanize's constructor pushes POST on to the
235       agent's "requests_redirectable" list (see also LWP::UserAgent.)
236
237   $mech->agent_alias( $alias )
238       Sets the user agent string to the expanded version from a table of
239       actual user strings.  $alias can be one of the following:
240
241       ·   Windows IE 6
242
243       ·   Windows Mozilla
244
245       ·   Mac Safari
246
247       ·   Mac Mozilla
248
249       ·   Linux Mozilla
250
251       ·   Linux Konqueror
252
253       then it will be replaced with a more interesting one.  For instance,
254
255           $mech->agent_alias( 'Windows IE 6' );
256
257       sets your User-Agent to
258
259           Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
260
261       The list of valid aliases can be returned from "known_agent_aliases()".
262       The current list is:
263
264       ·   Windows IE 6
265
266       ·   Windows Mozilla
267
268       ·   Mac Safari
269
270       ·   Mac Mozilla
271
272       ·   Linux Mozilla
273
274       ·   Linux Konqueror
275
276   known_agent_aliases()
277       Returns a list of all the agent aliases that Mech knows about.
278

PAGE-FETCHING METHODS

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

STATUS METHODS

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

CONTENT-HANDLING METHODS

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

IMAGE METHODS

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

FORM METHODS

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

FIELD METHODS

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

MISCELLANEOUS METHODS

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

OVERRIDDEN LWP::UserAgent METHODS

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

INHERITED UNCHANGED LWP::UserAgent METHODS

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

INTERNAL-ONLY METHODS

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

BEST PRACTICES

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

WWW::MECHANIZE'S GIT REPOSITORY

1380       WWW::Mechanize is hosted at GitHub.
1381
1382       Repository: <https://github.com/libwww-perl/WWW-Mechanize>.  Bugs:
1383       <https://github.com/libwww-perl/WWW-Mechanize/issues>.
1384

OTHER DOCUMENTATION

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

ONLINE RESOURCES AND SUPPORT

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

ARTICLES ABOUT WWW::MECHANIZE

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

ACKNOWLEDGEMENTS

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

AUTHOR

1532       Andy Lester <andy at petdance.com>
1533
1535       This software is copyright (c) 2004-2016 by Andy Lester.
1536
1537       This is free software; you can redistribute it and/or modify it under
1538       the same terms as the Perl 5 programming language system itself.
1539
1540
1541
1542perl v5.30.1                      2020-01-30                 WWW::Mechanize(3)
Impressum