Subject: | blessed() on HTML::TreeBuilder input |
Date: | Sat, 19 Jan 2013 09:36:39 +1100 |
To: | bug-HTML-ExtractMain [...] rt.cpan.org |
From: | Kevin Ryde <user42 [...] zip.com.au> |
In 0.62 I think there may be a missing import of the "blessed()" used
when the input is an object, such as a HTML::TreeBuilder, per
"format-patch" diff and test case below.
From da9e9d6b908058475358c2091e9636cf2bd8eb16 Mon Sep 17 00:00:00 2001
From: Kevin Ryde <user42@zip.com.au>
Date: Thu, 17 Jan 2013 14:47:54 +1100
Subject: [PATCH] Must import blessed() for HTML::TreeBuilder input.
---
Changes | 3 +++
lib/HTML/ExtractMain.pm | 8 ++++----
t/html_extract_main.t | 16 +++++++++++++++-
3 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/Changes b/Changes
index d055cae..cd9fbf6 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,8 @@
Revision history for HTML-ExtractMain
+0.63 January 19, 2013
+ Fixed missing "blessed()" for HTML::TreeBuilder input
+
0.62 December 13, 2010
Fixed error with build requirements
diff --git a/lib/HTML/ExtractMain.pm b/lib/HTML/ExtractMain.pm
index 8dd7d9b..1acc0b7 100644
--- a/lib/HTML/ExtractMain.pm
+++ b/lib/HTML/ExtractMain.pm
@@ -4,7 +4,7 @@ package HTML::ExtractMain;
use Carp qw( carp );
use HTML::TreeBuilder;
use Object::Destroyer 2.0;
-use Scalar::Util qw( refaddr );
+use Scalar::Util qw( blessed refaddr );
use base qw( Exporter );
use strict;
use warnings;
@@ -101,11 +101,11 @@ HTML::ExtractMain - Extract the main content of a web page
=head1 VERSION
-Version 0.62
+Version 0.63
=cut
-our $VERSION = '0.62';
+our $VERSION = '0.63';
=head1 SYNOPSIS
@@ -212,7 +212,7 @@ L<http://code.google.com/p/arc90labs-readability/>.
=head1 COPYRIGHT & LICENSE
-Copyright 2009-2010 Anirvan Chatterjee, all rights reserved.
+Copyright 2009-2010, 2013 Anirvan Chatterjee, all rights reserved.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
diff --git a/t/html_extract_main.t b/t/html_extract_main.t
index b3fb63c..814b667 100644
--- a/t/html_extract_main.t
+++ b/t/html_extract_main.t
@@ -1,6 +1,6 @@
#!perl
-use Test::More tests => 5;
+use Test::More tests => 6;
use_ok( 'HTML::ExtractMain', 'extract_main_html' );
@@ -27,6 +27,20 @@ is( $r,
is( extract_main_html('<p>Hi!</p>'), '<p>Hi!</p>', 'simple content works' );
+#------------------------------------------------------------------------------
+# with HTML::TreeBuilder input
+
+{
+ require HTML::TreeBuilder;
+ my $simple = '<p>Hi!</p>';
+ my $tree = HTML::TreeBuilder->new_from_content($simple);
+ my $got = extract_main_html($tree);
+ is ($got, $simple, 'simple content as TreeBuilder');
+}
+
+
+#------------------------------------------------------------------------------
+
# Local Variables:
# mode: perltidy
# End:
--
1.7.10.4