[Catalyst-commits] r7387 - in trunk/WWW-Mechanize-TreeBuilder:
lib/WWW/Mechanize t t/lib
ash at dev.catalyst.perl.org
ash at dev.catalyst.perl.org
Mon Jan 14 22:26:16 GMT 2008
Author: ash
Date: 2008-01-14 22:26:14 +0000 (Mon, 14 Jan 2008)
New Revision: 7387
Modified:
trunk/WWW-Mechanize-TreeBuilder/lib/WWW/Mechanize/TreeBuilder.pm
trunk/WWW-Mechanize-TreeBuilder/t/01-basic.t
trunk/WWW-Mechanize-TreeBuilder/t/lib/MockMechanize.pm
Log:
Fix clone delegation
Modified: trunk/WWW-Mechanize-TreeBuilder/lib/WWW/Mechanize/TreeBuilder.pm
===================================================================
--- trunk/WWW-Mechanize-TreeBuilder/lib/WWW/Mechanize/TreeBuilder.pm 2008-01-14 00:14:12 UTC (rev 7386)
+++ trunk/WWW-Mechanize-TreeBuilder/lib/WWW/Mechanize/TreeBuilder.pm 2008-01-14 22:26:14 UTC (rev 7387)
@@ -46,14 +46,17 @@
=head1 METHODS
Everything in L<WWW::Mechanize> (or which ever sub class you apply it to) and
-all public methods from L<HTML::Element>.
+all public methods from L<HTML::Element> except those which WWW::Mechanize
+and HTML::Element give this method. In the case where WWW::Mechanize and
+HTML::TreeBuilder boht define a method, the one from WWW::Mechanize will be
+used (so that the behaviour of Mechanize wont get broken.)
=cut
use Moose::Role;
use HTML::TreeBuilder;
-our $VERSION = '1.00002';
+our $VERSION = '1.00003';
requires '_make_request';
@@ -73,7 +76,7 @@
return
map { $_ => $_ }
- grep { !/^_/ } $delegate_class->list_all_package_symbols('CODE');
+ grep { !/^_/ && !$class->can($_) } $delegate_class->list_all_package_symbols('CODE');
}
);
Modified: trunk/WWW-Mechanize-TreeBuilder/t/01-basic.t
===================================================================
--- trunk/WWW-Mechanize-TreeBuilder/t/01-basic.t 2008-01-14 00:14:12 UTC (rev 7386)
+++ trunk/WWW-Mechanize-TreeBuilder/t/01-basic.t 2008-01-14 22:26:14 UTC (rev 7387)
@@ -4,7 +4,7 @@
use FindBin;
use lib "$FindBin::Bin/../t/lib";
-use Test::More tests => 10;
+use Test::More tests => 12;
BEGIN {
use_ok 'WWW::Mechanize::TreeBuilder';
@@ -26,6 +26,9 @@
isa_ok($mech->find('h1'), 'HTML::Element', 'Can find an H1 tag');
like($mech->find('title')->as_trimmed_text, qr/\x{2603}/, 'Copes properly with utf8 encoded data'); # Snowman utf8 test
+$mech->get_ok('/image', "Get image okay");
+ok(!$mech->has_tree, "No tree for an image request");
+
$mech->get_ok('/plain', "Request plain text resource");
ok( !$mech->has_tree, "Plain text content-type has no tree");
Modified: trunk/WWW-Mechanize-TreeBuilder/t/lib/MockMechanize.pm
===================================================================
--- trunk/WWW-Mechanize-TreeBuilder/t/lib/MockMechanize.pm 2008-01-14 00:14:12 UTC (rev 7386)
+++ trunk/WWW-Mechanize-TreeBuilder/t/lib/MockMechanize.pm 2008-01-14 22:26:14 UTC (rev 7387)
@@ -27,6 +27,8 @@
EOF
} elsif ($req->uri eq '/plain') {
$res = HTTP::Response->new(200, 'OK', ['Content-Type' => 'text/plain'], "I'm plain text");
+ } elsif ($req->uri eq '/image') {
+ $res = HTTP::Response->new(200, 'OK', ['Content-Type' => 'image/gif'], "I should be an image");
}
$res->request($req);
More information about the Catalyst-commits
mailing list