Add built local::lib
[catagits/Gitalist.git] / local-lib5 / man / man3 / Test::WWW::Mechanize.3pm
1 .\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.10)
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sp \" Vertical space (when we can't use .PP)
6 .if t .sp .5v
7 .if n .sp
8 ..
9 .de Vb \" Begin verbatim text
10 .ft CW
11 .nf
12 .ne \\$1
13 ..
14 .de Ve \" End verbatim text
15 .ft R
16 .fi
17 ..
18 .\" Set up some character translations and predefined strings.  \*(-- will
19 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
20 .\" double quote, and \*(R" will give a right double quote.  \*(C+ will
21 .\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
22 .\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
23 .\" nothing in troff, for use with C<>.
24 .tr \(*W-
25 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
26 .ie n \{\
27 .    ds -- \(*W-
28 .    ds PI pi
29 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
30 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
31 .    ds L" ""
32 .    ds R" ""
33 .    ds C` ""
34 .    ds C' ""
35 'br\}
36 .el\{\
37 .    ds -- \|\(em\|
38 .    ds PI \(*p
39 .    ds L" ``
40 .    ds R" ''
41 'br\}
42 .\"
43 .\" Escape single quotes in literal strings from groff's Unicode transform.
44 .ie \n(.g .ds Aq \(aq
45 .el       .ds Aq '
46 .\"
47 .\" If the F register is turned on, we'll generate index entries on stderr for
48 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
49 .\" entries marked with X<> in POD.  Of course, you'll have to process the
50 .\" output yourself in some meaningful fashion.
51 .ie \nF \{\
52 .    de IX
53 .    tm Index:\\$1\t\\n%\t"\\$2"
54 ..
55 .    nr % 0
56 .    rr F
57 .\}
58 .el \{\
59 .    de IX
60 ..
61 .\}
62 .\"
63 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
64 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
65 .    \" fudge factors for nroff and troff
66 .if n \{\
67 .    ds #H 0
68 .    ds #V .8m
69 .    ds #F .3m
70 .    ds #[ \f1
71 .    ds #] \fP
72 .\}
73 .if t \{\
74 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
75 .    ds #V .6m
76 .    ds #F 0
77 .    ds #[ \&
78 .    ds #] \&
79 .\}
80 .    \" simple accents for nroff and troff
81 .if n \{\
82 .    ds ' \&
83 .    ds ` \&
84 .    ds ^ \&
85 .    ds , \&
86 .    ds ~ ~
87 .    ds /
88 .\}
89 .if t \{\
90 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
91 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
92 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
93 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
94 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
95 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
96 .\}
97 .    \" troff and (daisy-wheel) nroff accents
98 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
99 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
100 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
101 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
102 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
103 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
104 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
105 .ds ae a\h'-(\w'a'u*4/10)'e
106 .ds Ae A\h'-(\w'A'u*4/10)'E
107 .    \" corrections for vroff
108 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
109 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
110 .    \" for low resolution devices (crt and lpr)
111 .if \n(.H>23 .if \n(.V>19 \
112 \{\
113 .    ds : e
114 .    ds 8 ss
115 .    ds o a
116 .    ds d- d\h'-1'\(ga
117 .    ds D- D\h'-1'\(hy
118 .    ds th \o'bp'
119 .    ds Th \o'LP'
120 .    ds ae ae
121 .    ds Ae AE
122 .\}
123 .rm #[ #] #H #V #F C
124 .\" ========================================================================
125 .\"
126 .IX Title "Mechanize 3"
127 .TH Mechanize 3 "2009-01-17" "perl v5.8.7" "User Contributed Perl Documentation"
128 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
129 .\" way too many mistakes in technical documents.
130 .if n .ad l
131 .nh
132 .SH "NAME"
133 Test::WWW::Mechanize \- Testing\-specific WWW::Mechanize subclass
134 .SH "VERSION"
135 .IX Header "VERSION"
136 Version 1.24
137 .SH "SYNOPSIS"
138 .IX Header "SYNOPSIS"
139 Test::WWW::Mechanize is a subclass of WWW::Mechanize that incorporates
140 features for web application testing.  For example:
141 .PP
142 .Vb 2
143 \&    use Test::More tests => 5;
144 \&    use Test::WWW::Mechanize;
145 \&
146 \&    my $mech = Test::WWW::Mechanize\->new;
147 \&    $mech\->get_ok( $page );
148 \&    $mech\->base_is( \*(Aqhttp://petdance.com/\*(Aq, \*(AqProper <BASE HREF>\*(Aq );
149 \&    $mech\->title_is( "Invoice Status", "Make sure we\*(Aqre on the invoice page" );
150 \&    $mech\->content_contains( "Andy Lester", "My name somewhere" );
151 \&    $mech\->content_like( qr/(cpan|perl)\e.org/, "Link to perl.org or CPAN" );
152 .Ve
153 .PP
154 This is equivalent to:
155 .PP
156 .Vb 2
157 \&    use Test::More tests => 5;
158 \&    use WWW::Mechanize;
159 \&
160 \&    my $mech = WWW::Mechanize\->new;
161 \&    $mech\->get( $page );
162 \&    ok( $mech\->success );
163 \&    is( $mech\->base, \*(Aqhttp://petdance.com\*(Aq, \*(AqProper <BASE HREF>\*(Aq );
164 \&    is( $mech\->title, "Invoice Status", "Make sure we\*(Aqre on the invoice page" );
165 \&    ok( index( $mech\->content, "Andy Lester" ) >= 0, "My name somewhere" );
166 \&    like( $mech\->content, qr/(cpan|perl)\e.org/, "Link to perl.org or CPAN" );
167 .Ve
168 .PP
169 but has nicer diagnostics if they fail.
170 .PP
171 Default descriptions will be supplied for most methods if you omit them. e.g.
172 .PP
173 .Vb 6
174 \&    my $mech = Test::WWW::Mechanize\->new;
175 \&    $mech\->get_ok( \*(Aqhttp://petdance.com/\*(Aq );
176 \&    $mech\->base_is( \*(Aqhttp://petdance.com/\*(Aq );
177 \&    $mech\->title_is( "Invoice Status" );
178 \&    $mech\->content_contains( "Andy Lester" );
179 \&    $mech\->content_like( qr/(cpan|perl)\e.org/ );
180 .Ve
181 .PP
182 results in
183 .PP
184 .Vb 5
185 \&    ok \- Got \*(Aqhttp://petdance.com/\*(Aq ok
186 \&    ok \- Base is \*(Aqhttp://petdance.com/\*(Aq
187 \&    ok \- Title is \*(AqInvoice Status\*(Aq
188 \&    ok \- Content contains \*(AqAndy Lester\*(Aq
189 \&    ok \- Content is like \*(Aq(?\-xism:(cpan|perl)\e.org)\*(Aq
190 .Ve
191 .SH "CONSTRUCTOR"
192 .IX Header "CONSTRUCTOR"
193 .ie n .SS "new( %args )"
194 .el .SS "new( \f(CW%args\fP )"
195 .IX Subsection "new( %args )"
196 Behaves like, and calls, WWW::Mechanize's \f(CW\*(C`new\*(C'\fR method.  Any parms
197 passed in get passed to WWW::Mechanize's constructor.
198 .PP
199 You can pass in \f(CW\*(C`autolint => 1\*(C'\fR to make Test::WWW::Mechanize
200 automatically run HTML::Lint after any of the following methods are
201 called.
202 .IP "\(bu" 4
203 \&\fIget_ok()\fR
204 .PP
205 and will eventually do the same after any of the following:
206 .IP "\(bu" 4
207 \&\fIpost_ok()\fR
208 .IP "\(bu" 4
209 \&\fIback_ok()\fR
210 .IP "\(bu" 4
211 \&\fIsubmit_form_ok()\fR
212 .IP "\(bu" 4
213 \&\fIfollow_link_ok()\fR
214 .IP "\(bu" 4
215 \&\fIclick_ok()\fR
216 .PP
217 This means you no longerhave to do the following:
218 .PP
219 .Vb 3
220 \&    my $mech = Test::WWW::Mechanize\->new();
221 \&    $mech\->get_ok( $url, \*(AqFetch the intro page\*(Aq );
222 \&    $mech\->html_lint_ok( \*(AqIntro page looks OK\*(Aq );
223 .Ve
224 .PP
225 and can simply do
226 .PP
227 .Vb 2
228 \&    my $mech = Test::WWW::Mechanize\->new( autolint => 1 );
229 \&    $mech\->get_ok( $url, \*(AqFetch the intro page\*(Aq );
230 .Ve
231 .PP
232 The \f(CW\*(C`$mech\->get_ok()\*(C'\fR only counts as one test in the test count.  Both the
233 main \s-1IO\s0 operation and the linting must pass for the entire test to pass.
234 .SH "METHODS: HTTP VERBS"
235 .IX Header "METHODS: HTTP VERBS"
236 .ie n .SS "$mech\->get_ok($url, [ \e%LWP_options ,] $desc)"
237 .el .SS "\f(CW$mech\fP\->get_ok($url, [ \e%LWP_options ,] \f(CW$desc\fP)"
238 .IX Subsection "$mech->get_ok($url, [ %LWP_options ,] $desc)"
239 A wrapper around WWW::Mechanize's \fIget()\fR, with similar options, except
240 the second argument needs to be a hash reference, not a hash. Like
241 well-behaved \f(CW\*(C`*_ok()\*(C'\fR functions, it returns true if the test passed,
242 or false if not.
243 .PP
244 A default description of \*(L"\s-1GET\s0 \f(CW$url\fR\*(R" is used if none if provided.
245 .ie n .SS "$mech\->head_ok($url, [ \e%LWP_options ,] $desc)"
246 .el .SS "\f(CW$mech\fP\->head_ok($url, [ \e%LWP_options ,] \f(CW$desc\fP)"
247 .IX Subsection "$mech->head_ok($url, [ %LWP_options ,] $desc)"
248 A wrapper around WWW::Mechanize's \fIhead()\fR, with similar options, except
249 the second argument needs to be a hash reference, not a hash. Like
250 well-behaved \f(CW\*(C`*_ok()\*(C'\fR functions, it returns true if the test passed,
251 or false if not.
252 .PP
253 A default description of \*(L"\s-1HEAD\s0 \f(CW$url\fR\*(R" is used if none if provided.
254 .ie n .SS "$mech\->post_ok( $url, [ \e%LWP_options ,] $desc )"
255 .el .SS "\f(CW$mech\fP\->post_ok( \f(CW$url\fP, [ \e%LWP_options ,] \f(CW$desc\fP )"
256 .IX Subsection "$mech->post_ok( $url, [ %LWP_options ,] $desc )"
257 A wrapper around WWW::Mechanize's \fIpost()\fR, with similar options, except
258 the second argument needs to be a hash reference, not a hash. Like
259 well-behaved \f(CW\*(C`*_ok()\*(C'\fR functions, it returns true if the test passed,
260 or false if not.
261 .PP
262 A default description of \*(L"\s-1POST\s0 to \f(CW$url\fR\*(R" is used if none if provided.
263 .ie n .SS "$mech\->put_ok( $url, [ \e%LWP_options ,] $desc )"
264 .el .SS "\f(CW$mech\fP\->put_ok( \f(CW$url\fP, [ \e%LWP_options ,] \f(CW$desc\fP )"
265 .IX Subsection "$mech->put_ok( $url, [ %LWP_options ,] $desc )"
266 A wrapper around WWW::Mechanize's \fIput()\fR, with similar options, except
267 the second argument needs to be a hash reference, not a hash. Like
268 well-behaved \f(CW\*(C`*_ok()\*(C'\fR functions, it returns true if the test passed,
269 or false if not.
270 .PP
271 A default description of \*(L"\s-1PUT\s0 to \f(CW$url\fR\*(R" is used if none if provided.
272 .ie n .SS "$mech\->submit_form_ok( \e%parms [, $desc] )"
273 .el .SS "\f(CW$mech\fP\->submit_form_ok( \e%parms [, \f(CW$desc\fP] )"
274 .IX Subsection "$mech->submit_form_ok( %parms [, $desc] )"
275 Makes a \f(CW\*(C`submit_form()\*(C'\fR call and executes tests on the results.
276 The form must be found, and then submitted successfully.  Otherwise,
277 this test fails.
278 .PP
279 \&\fI\f(CI%parms\fI\fR is a hashref containing the parms to pass to \f(CW\*(C`submit_form()\*(C'\fR.
280 Note that the parms to \f(CW\*(C`submit_form()\*(C'\fR are a hash whereas the parms to
281 this function are a hashref.  You have to call this function like:
282 .PP
283 .Vb 1
284 \&    $agent\->submit_form_ok( {n=>3}, "looking for 3rd link" );
285 .Ve
286 .PP
287 As with other test functions, \f(CW$desc\fR is optional.  If it is supplied
288 then it will display when running the test harness in verbose mode.
289 .PP
290 Returns true value if the specified link was found and followed
291 successfully.  The HTTP::Response object returned by \fIsubmit_form()\fR
292 is not available.
293 .ie n .SS "$mech\->follow_link_ok( \e%parms [, $desc] )"
294 .el .SS "\f(CW$mech\fP\->follow_link_ok( \e%parms [, \f(CW$desc\fP] )"
295 .IX Subsection "$mech->follow_link_ok( %parms [, $desc] )"
296 Makes a \f(CW\*(C`follow_link()\*(C'\fR call and executes tests on the results.
297 The link must be found, and then followed successfully.  Otherwise,
298 this test fails.
299 .PP
300 \&\fI\f(CI%parms\fI\fR is a hashref containing the parms to pass to \f(CW\*(C`follow_link()\*(C'\fR.
301 Note that the parms to \f(CW\*(C`follow_link()\*(C'\fR are a hash whereas the parms to
302 this function are a hashref.  You have to call this function like:
303 .PP
304 .Vb 1
305 \&    $mech\->follow_link_ok( {n=>3}, "looking for 3rd link" );
306 .Ve
307 .PP
308 As with other test functions, \f(CW$desc\fR is optional.  If it is supplied
309 then it will display when running the test harness in verbose mode.
310 .PP
311 Returns a true value if the specified link was found and followed
312 successfully.  The HTTP::Response object returned by \fIfollow_link()\fR
313 is not available.
314 .ie n .SS "click_ok( $button[, $desc] )"
315 .el .SS "click_ok( \f(CW$button\fP[, \f(CW$desc\fP] )"
316 .IX Subsection "click_ok( $button[, $desc] )"
317 Clicks the button named by \f(CW$button\fR.  An optional \f(CW$desc\fR can
318 be given for the test.
319 .SH "METHODS: CONTENT CHECKING"
320 .IX Header "METHODS: CONTENT CHECKING"
321 .ie n .SS "$mech\->html_lint_ok( [$desc] )"
322 .el .SS "\f(CW$mech\fP\->html_lint_ok( [$desc] )"
323 .IX Subsection "$mech->html_lint_ok( [$desc] )"
324 Checks the validity of the \s-1HTML\s0 on the current page.  If the page is not
325 \&\s-1HTML\s0, then it fails.  The \s-1URI\s0 is automatically appended to the \fI\f(CI$desc\fI\fR.
326 .PP
327 Note that HTML::Lint must be installed for this to work.  Otherwise,
328 it will blow up.
329 .ie n .SS "$mech\->title_is( $str [, $desc ] )"
330 .el .SS "\f(CW$mech\fP\->title_is( \f(CW$str\fP [, \f(CW$desc\fP ] )"
331 .IX Subsection "$mech->title_is( $str [, $desc ] )"
332 Tells if the title of the page is the given string.
333 .PP
334 .Vb 1
335 \&    $mech\->title_is( "Invoice Summary" );
336 .Ve
337 .ie n .SS "$mech\->title_like( $regex [, $desc ] )"
338 .el .SS "\f(CW$mech\fP\->title_like( \f(CW$regex\fP [, \f(CW$desc\fP ] )"
339 .IX Subsection "$mech->title_like( $regex [, $desc ] )"
340 Tells if the title of the page matches the given regex.
341 .PP
342 .Vb 1
343 \&    $mech\->title_like( qr/Invoices for (.+)/
344 .Ve
345 .ie n .SS "$mech\->title_unlike( $regex [, $desc ] )"
346 .el .SS "\f(CW$mech\fP\->title_unlike( \f(CW$regex\fP [, \f(CW$desc\fP ] )"
347 .IX Subsection "$mech->title_unlike( $regex [, $desc ] )"
348 Tells if the title of the page matches the given regex.
349 .PP
350 .Vb 1
351 \&    $mech\->title_unlike( qr/Invoices for (.+)/
352 .Ve
353 .ie n .SS "$mech\->base_is( $str [, $desc ] )"
354 .el .SS "\f(CW$mech\fP\->base_is( \f(CW$str\fP [, \f(CW$desc\fP ] )"
355 .IX Subsection "$mech->base_is( $str [, $desc ] )"
356 Tells if the base of the page is the given string.
357 .PP
358 .Vb 1
359 \&    $mech\->base_is( "http://example.com/" );
360 .Ve
361 .ie n .SS "$mech\->base_like( $regex [, $desc ] )"
362 .el .SS "\f(CW$mech\fP\->base_like( \f(CW$regex\fP [, \f(CW$desc\fP ] )"
363 .IX Subsection "$mech->base_like( $regex [, $desc ] )"
364 Tells if the base of the page matches the given regex.
365 .PP
366 .Vb 1
367 \&    $mech\->base_like( qr{http://example.com/index.php?PHPSESSID=(.+)});
368 .Ve
369 .ie n .SS "$mech\->base_unlike( $regex [, $desc ] )"
370 .el .SS "\f(CW$mech\fP\->base_unlike( \f(CW$regex\fP [, \f(CW$desc\fP ] )"
371 .IX Subsection "$mech->base_unlike( $regex [, $desc ] )"
372 Tells if the base of the page matches the given regex.
373 .PP
374 .Vb 1
375 \&    $mech\->base_unlike( qr{http://example.com/index.php?PHPSESSID=(.+)});
376 .Ve
377 .ie n .SS "$mech\->content_is( $str [, $desc ] )"
378 .el .SS "\f(CW$mech\fP\->content_is( \f(CW$str\fP [, \f(CW$desc\fP ] )"
379 .IX Subsection "$mech->content_is( $str [, $desc ] )"
380 Tells if the content of the page matches the given string
381 .ie n .SS "$mech\->content_contains( $str [, $desc ] )"
382 .el .SS "\f(CW$mech\fP\->content_contains( \f(CW$str\fP [, \f(CW$desc\fP ] )"
383 .IX Subsection "$mech->content_contains( $str [, $desc ] )"
384 Tells if the content of the page contains \fI\f(CI$str\fI\fR.
385 .ie n .SS "$mech\->content_lacks( $str [, $desc ] )"
386 .el .SS "\f(CW$mech\fP\->content_lacks( \f(CW$str\fP [, \f(CW$desc\fP ] )"
387 .IX Subsection "$mech->content_lacks( $str [, $desc ] )"
388 Tells if the content of the page lacks \fI\f(CI$str\fI\fR.
389 .ie n .SS "$mech\->content_like( $regex [, $desc ] )"
390 .el .SS "\f(CW$mech\fP\->content_like( \f(CW$regex\fP [, \f(CW$desc\fP ] )"
391 .IX Subsection "$mech->content_like( $regex [, $desc ] )"
392 Tells if the content of the page matches \fI\f(CI$regex\fI\fR.
393 .ie n .SS "$mech\->content_unlike( $regex [, $desc ] )"
394 .el .SS "\f(CW$mech\fP\->content_unlike( \f(CW$regex\fP [, \f(CW$desc\fP ] )"
395 .IX Subsection "$mech->content_unlike( $regex [, $desc ] )"
396 Tells if the content of the page does \s-1NOT\s0 match \fI\f(CI$regex\fI\fR.
397 .ie n .SS "$mech\->has_tag( $tag, $text [, $desc ] )"
398 .el .SS "\f(CW$mech\fP\->has_tag( \f(CW$tag\fP, \f(CW$text\fP [, \f(CW$desc\fP ] )"
399 .IX Subsection "$mech->has_tag( $tag, $text [, $desc ] )"
400 Tells if the page has a \f(CW$tag\fR tag with the given content in its text.
401 .ie n .SS "$mech\->has_tag_like( $tag, $regex [, $desc ] )"
402 .el .SS "\f(CW$mech\fP\->has_tag_like( \f(CW$tag\fP, \f(CW$regex\fP [, \f(CW$desc\fP ] )"
403 .IX Subsection "$mech->has_tag_like( $tag, $regex [, $desc ] )"
404 Tells if the page has a \f(CW$tag\fR tag with the given content in its text.
405 .ie n .SS "$mech\->\fIfollowable_links()\fP"
406 .el .SS "\f(CW$mech\fP\->\fIfollowable_links()\fP"
407 .IX Subsection "$mech->followable_links()"
408 Returns a list of links that Mech can follow.  This is only http and
409 https links.
410 .ie n .SS "$mech\->page_links_ok( [ $desc ] )"
411 .el .SS "\f(CW$mech\fP\->page_links_ok( [ \f(CW$desc\fP ] )"
412 .IX Subsection "$mech->page_links_ok( [ $desc ] )"
413 Follow all links on the current page and test for \s-1HTTP\s0 status 200
414 .PP
415 .Vb 1
416 \&    $mech\->page_links_ok(\*(AqCheck all links\*(Aq);
417 .Ve
418 .ie n .SS "$mech\->page_links_content_like( $regex [, $desc ] )"
419 .el .SS "\f(CW$mech\fP\->page_links_content_like( \f(CW$regex\fP [, \f(CW$desc\fP ] )"
420 .IX Subsection "$mech->page_links_content_like( $regex [, $desc ] )"
421 Follow all links on the current page and test their contents for \fI\f(CI$regex\fI\fR.
422 .PP
423 .Vb 2
424 \&    $mech\->page_links_content_like( qr/foo/,
425 \&      \*(AqCheck all links contain "foo"\*(Aq );
426 .Ve
427 .ie n .SS "$mech\->page_links_content_unlike( $regex [, $desc ] )"
428 .el .SS "\f(CW$mech\fP\->page_links_content_unlike( \f(CW$regex\fP [, \f(CW$desc\fP ] )"
429 .IX Subsection "$mech->page_links_content_unlike( $regex [, $desc ] )"
430 Follow all links on the current page and test their contents do not
431 contain the specified regex.
432 .PP
433 .Vb 2
434 \&    $mech\->page_links_content_unlike(qr/Restricted/,
435 \&      \*(AqCheck all links do not contain Restricted\*(Aq);
436 .Ve
437 .ie n .SS "$mech\->links_ok( $links [, $desc ] )"
438 .el .SS "\f(CW$mech\fP\->links_ok( \f(CW$links\fP [, \f(CW$desc\fP ] )"
439 .IX Subsection "$mech->links_ok( $links [, $desc ] )"
440 Follow specified links on the current page and test for \s-1HTTP\s0 status
441 200.  The links may be specified as a reference to an array containing
442 WWW::Mechanize::Link objects, an array of URLs, or a scalar \s-1URL\s0
443 name.
444 .PP
445 .Vb 2
446 \&    my @links = $mech\->find_all_links( url_regex => qr/cnn\e.com$/ );
447 \&    $mech\->links_ok( \e@links, \*(AqCheck all links for cnn.com\*(Aq );
448 \&
449 \&    my @links = qw( index.html search.html about.html );
450 \&    $mech\->links_ok( \e@links, \*(AqCheck main links\*(Aq );
451 \&
452 \&    $mech\->links_ok( \*(Aqindex.html\*(Aq, \*(AqCheck link to index\*(Aq );
453 .Ve
454 .ie n .SS "$mech\->link_status_is( $links, $status [, $desc ] )"
455 .el .SS "\f(CW$mech\fP\->link_status_is( \f(CW$links\fP, \f(CW$status\fP [, \f(CW$desc\fP ] )"
456 .IX Subsection "$mech->link_status_is( $links, $status [, $desc ] )"
457 Follow specified links on the current page and test for \s-1HTTP\s0 status
458 passed.  The links may be specified as a reference to an array
459 containing WWW::Mechanize::Link objects, an array of URLs, or a
460 scalar \s-1URL\s0 name.
461 .PP
462 .Vb 3
463 \&    my @links = $mech\->followable_links();
464 \&    $mech\->link_status_is( \e@links, 403,
465 \&      \*(AqCheck all links are restricted\*(Aq );
466 .Ve
467 .ie n .SS "$mech\->link_status_isnt( $links, $status [, $desc ] )"
468 .el .SS "\f(CW$mech\fP\->link_status_isnt( \f(CW$links\fP, \f(CW$status\fP [, \f(CW$desc\fP ] )"
469 .IX Subsection "$mech->link_status_isnt( $links, $status [, $desc ] )"
470 Follow specified links on the current page and test for \s-1HTTP\s0 status
471 passed.  The links may be specified as a reference to an array
472 containing WWW::Mechanize::Link objects, an array of URLs, or a
473 scalar \s-1URL\s0 name.
474 .PP
475 .Vb 3
476 \&    my @links = $mech\->followable_links();
477 \&    $mech\->link_status_isnt( \e@links, 404,
478 \&      \*(AqCheck all links are not 404\*(Aq );
479 .Ve
480 .ie n .SS "$mech\->link_content_like( $links, $regex [, $desc ] )"
481 .el .SS "\f(CW$mech\fP\->link_content_like( \f(CW$links\fP, \f(CW$regex\fP [, \f(CW$desc\fP ] )"
482 .IX Subsection "$mech->link_content_like( $links, $regex [, $desc ] )"
483 Follow specified links on the current page and test the resulting
484 content of each against \fI\f(CI$regex\fI\fR.  The links may be specified as a
485 reference to an array containing WWW::Mechanize::Link objects, an
486 array of URLs, or a scalar \s-1URL\s0 name.
487 .PP
488 .Vb 3
489 \&    my @links = $mech\->followable_links();
490 \&    $mech\->link_content_like( \e@links, qr/Restricted/,
491 \&        \*(AqCheck all links are restricted\*(Aq );
492 .Ve
493 .ie n .SS "$mech\->link_content_unlike( $links, $regex [, $desc ] )"
494 .el .SS "\f(CW$mech\fP\->link_content_unlike( \f(CW$links\fP, \f(CW$regex\fP [, \f(CW$desc\fP ] )"
495 .IX Subsection "$mech->link_content_unlike( $links, $regex [, $desc ] )"
496 Follow specified links on the current page and test that the resulting
497 content of each does not match \fI\f(CI$regex\fI\fR.  The links may be specified as a
498 reference to an array containing WWW::Mechanize::Link objects, an array
499 of URLs, or a scalar \s-1URL\s0 name.
500 .PP
501 .Vb 3
502 \&    my @links = $mech\->followable_links();
503 \&    $mech\->link_content_unlike( \e@links, qr/Restricted/,
504 \&      \*(AqNo restricted links\*(Aq );
505 .Ve
506 .ie n .SS "$mech\->stuff_inputs( [\e%options] )"
507 .el .SS "\f(CW$mech\fP\->stuff_inputs( [\e%options] )"
508 .IX Subsection "$mech->stuff_inputs( [%options] )"
509 Finds all free-text input fields (text, textarea, and password) in the
510 current form and fills them to their maximum length in hopes of finding
511 application code that can't handle it.  Fields with no maximum length
512 and all textarea fields are set to 66000 bytes, which will often be
513 enough to overflow the data's eventual recepticle.
514 .PP
515 There is no return value.
516 .PP
517 If there is no current form then nothing is done.
518 .PP
519 The hashref \f(CW$options\fR can contain the following keys:
520 .IP "\(bu" 4
521 ignore
522 .Sp
523 hash value is arrayref of field names to not touch, e.g.:
524 .Sp
525 .Vb 3
526 \&    $mech\->stuff_inputs( {
527 \&        ignore => [qw( specialfield1 specialfield2 )],
528 \&    } );
529 .Ve
530 .IP "\(bu" 4
531 fill
532 .Sp
533 hash value is default string to use when stuffing fields.  Copies
534 of the string are repeated up to the max length of each field.  E.g.:
535 .Sp
536 .Vb 3
537 \&    $mech\->stuff_inputs( {
538 \&        fill => \*(Aq@\*(Aq  # stuff all fields with something easy to recognize
539 \&    } );
540 .Ve
541 .IP "\(bu" 4
542 specs
543 .Sp
544 hash value is arrayref of hashrefs with which you can pass detailed
545 instructions about how to stuff a given field.  E.g.:
546 .Sp
547 .Vb 8
548 \&    $mech\->stuff_inputs( {
549 \&        specs=>{
550 \&            # Some fields are datatype\-constrained.  It\*(Aqs most common to
551 \&            # want the field stuffed with valid data.
552 \&            widget_quantity => { fill=>\*(Aq9\*(Aq },
553 \&            notes => { maxlength=>2000 },
554 \&        }
555 \&    } );
556 .Ve
557 .Sp
558 The specs allowed are \fIfill\fR (use this fill for the field rather than
559 the default) and \fImaxlength\fR (use this as the field's maxlength instead
560 of any maxlength specified in the \s-1HTML\s0).
561 .SH "TODO"
562 .IX Header "TODO"
563 Add HTML::Tidy capabilities.
564 .PP
565 Add a broken image check.
566 .SH "AUTHOR"
567 .IX Header "AUTHOR"
568 Andy Lester, \f(CW\*(C`<andy at petdance.com>\*(C'\fR
569 .SH "BUGS"
570 .IX Header "BUGS"
571 Please report any bugs or feature requests to
572 <http://code.google.com/p/www\-mechanize/issues/list>.  I will be
573 notified, and then you'll automatically be notified of progress on
574 your bug as I make changes.
575 .SH "SUPPORT"
576 .IX Header "SUPPORT"
577 You can find documentation for this module with the perldoc command.
578 .PP
579 .Vb 1
580 \&    perldoc Test::WWW::Mechanize
581 .Ve
582 .PP
583 You can also look for information at:
584 .IP "\(bu" 4
585 Google Code bug tracker
586 .Sp
587 <http://code.google.com/p/www\-mechanize/issues/list>
588 .Sp
589 Please \fBdo not use\fR the old queues for WWW::Mechanize and
590 Test::WWW::Mechanize at
591 <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test\-WWW\-Mechanize>
592 .IP "\(bu" 4
593 AnnoCPAN: Annotated \s-1CPAN\s0 documentation
594 .Sp
595 <http://annocpan.org/dist/Test\-WWW\-Mechanize>
596 .IP "\(bu" 4
597 \&\s-1CPAN\s0 Ratings
598 .Sp
599 <http://cpanratings.perl.org/d/Test\-WWW\-Mechanize>
600 .IP "\(bu" 4
601 Search \s-1CPAN\s0
602 .Sp
603 <http://search.cpan.org/dist/Test\-WWW\-Mechanize>
604 .SH "ACKNOWLEDGEMENTS"
605 .IX Header "ACKNOWLEDGEMENTS"
606 Thanks to
607 Greg Sheard,
608 Michael Schwern,
609 Mark Blackman,
610 Mike O'Regan,
611 Shawn Sorichetti,
612 Chris Dolan,
613 Matt Trout,
614 \&\s-1MATSUNO\s0 Tokuhiro,
615 and Pete Krawczyk for patches.
616 .SH "COPYRIGHT & LICENSE"
617 .IX Header "COPYRIGHT & LICENSE"
618 Copyright 2004\-2008 Andy Lester, all rights reserved.
619 .PP
620 This program is free software; you can redistribute it and/or modify it
621 under the same terms as Perl itself.