Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Test-WWW-Mechanize CPAN distribution.

Report information
The Basics
Id: 14465
Status: resolved
Priority: 0/
Queue: Test-WWW-Mechanize

People
Owner: Nobody in particular
Requestors: tokuhiro [...] mfac.jp
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



From: MATSUNO Tokuhiro <tokuhiro [...] mfac.jp>
Subject: base_(is|like|unlike) patch of Test::WWW::Mechanize
Date: Mon, 05 Sep 2005 12:35:13 +0900
To: Andy Lester <andy [...] petdance.com>
Nice to meet you, Mr. Andy Lister. I'm MATSUNO Tokuhiro, Japanese Perl Monger. I'm a user of Test::WWW::Mechanize. In the web application, if authorizer failed then redirect. I want to test redirect url. I want to three methods in Test::WWW::Mechanize. * base_is * base_like * base_unlike I wrote the patch. I want to merge to Test::WWW::Mechanize. Thanks, tokuhirom. --- Mechanize.pm.orig Mon Sep 5 12:25:46 2005 +++ Mechanize.pm Mon Sep 5 11:58:19 2005 @@ -10,7 +10,7 @@ =cut -our $VERSION = '1.06'; +our $VERSION = '1.07'; =head1 SYNOPSIS @@ -109,6 +109,57 @@ } return $ok; +} + +=head2 $mech->base_is( $str [, $desc ] ) + +Tells if the base of the page is the given string. + + $mech->base_is( "http://example.com/" ); + +=cut + +sub base_is { + my $self = shift; + my $str = shift; + my $desc = shift; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + return is_string( $self->base, $str, $desc ); +} + +=head2 $mech->base_like( $regex [, $desc ] ) + +Tells if the base of the page matches the given regex. + + $mech->base_like( qr{http://example.com/index.php?PHPSESSID=(.+)}); + +=cut + +sub base_like { + my $self = shift; + my $regex = shift; + my $desc = shift; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + return like_string( $self->base, $regex, $desc ); +} + +=head2 $mech->base_unlike( $regex [, $desc ] ) + +Tells if the base of the page matches the given regex. + + $mech->base_unlike( qr{http://example.com/index.php?PHPSESSID=(.+)}); + +=cut + +sub base_unlike { + my $self = shift; + my $regex = shift; + my $desc = shift; + + local $Test::Builder::Level = $Test::Builder::Level + 1; + return unlike_string( $self->base, $regex, $desc ); } =head2 $mech->title_is( $str [, $desc ] ) ----------------------------------- $B")(B153-0063 $BEl5~ETL\9u6hL\9u(B1-4-16 $BL\9u(BG$B%S%k(B6F TEL 03-5740-6155 FAX 03-5740-6156 $B3t<02q<R%b%P%$%k%U%!%/%H%j!<(B $B%7%9%F%`3+H/It(B $B>>Ln(B $BFABg(B mail$B!'(Btokuhiro@mfac.jp url$B!'(Bhttp://www.mobilefactory.jp/ -----------------------------------

Message body is not shown because sender requested not to inline it.

Thanks. I've added this in 1.10.