Skip Menu |

This queue is for tickets about the HTML-Format CPAN distribution.

Report information
The Basics
Id: 54636
Status: resolved
Priority: 0/
Queue: HTML-Format

People
Owner: nigel.metheringham [...] gmail.com
Requestors: user42 [...] zip.com.au
Cc:
AdminCc:

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



Subject: HTML::Formatter can() vs 5.11.4
Date: Tue, 16 Feb 2010 08:49:49 +1100
To: bug-HTML-Format [...] rt.cpan.org
From: Kevin Ryde <user42 [...] zip.com.au>
One of my cpantesters reports http://www.cpantesters.org/cpan/report/6821342 claims (among other things) # UNIVERSAL->import is deprecated and will be removed in a future perl at /home/david/cpantesting/perl-5.11.4/lib/site_perl/5.11.4/HTML/Formatter.pm line 110 # at /home/david/cpantesting/perl-5.11.4/lib/5.11.4/UNIVERSAL.pm line 20 # UNIVERSAL::import('UNIVERSAL', 'can') called at /home/david/cpantesting/perl-5.11.4/lib/site_perl/5.11.4/HTML/Formatter.pm line 110 # HTML::Formatter::BEGIN() called at /home/david/cpantesting/perl-5.11.4/lib/site_perl/5.11.4/HTML/Formatter.pm line 110 # eval {...} called at /home/david/cpantesting/perl-5.11.4/lib/site_perl/5.11.4/HTML/Formatter.pm line 110 # require HTML/Formatter.pm called at /home/david/cpantesting/perl-5.11.4/lib/site_perl/5.11.4/HTML/FormatText.pm line 68 # HTML::FormatText::BEGIN() called at /home/david/cpantesting/perl-5.11.4/lib/site_perl/5.11.4/HTML/Formatter.pm line 110 # eval {...} called at /home/david/cpantesting/perl-5.11.4/lib/site_perl/5.11.4/HTML/Formatter.pm line 110 # require HTML/FormatText.pm called at /home/david/cpantesting/perl-5.11.4/.cpan/build/rss2leafnode-20-ZAG9Rz/blib/lib/App/RSS2Leafnode.pm line 1328 # App::RSS2Leafnode::elt_to_rendered_text('XML::Twig::Elt=HASH(0x135d258)') called at /home/david/cpantesting/perl-5.11.4/.cpan/build/rss2leafnode-20-ZAG9Rz/blib/lib/App/RSS2Leafnode.pm line 1436 # App::RSS2Leafnode::item_to_copyright('App::RSS2Leafnode=HASH(0xbed388)', 'XML::Twig::Elt=HASH(0x136eb60)') called at t/RSS2Leafnode.t line 216 I suppose it's objecting to import of can() in HTML::Formatter. Maybe it's supposed to be used as a method ->can. I don't know what the word "deprecated" means, it might be a misspelling of depreciated, except in this context it seems to mean "incompatible change".
Subject: [PATCH] Fix deprecated UNIVERSAL::can import for 5.12
Perl 5.12 warns loudly about importing from UNIVERSAL, which is deprecated. Silencing the warnings requires using the method version. I've attached the simple patch to do so. Thomas
Subject: universal-can.patch
--- lib/HTML/Formatter.pm.orig 2004-06-02 03:47:16.000000000 -0400 +++ lib/HTML/Formatter.pm 2010-08-19 20:55:16.136109557 -0400 @@ -107,7 +107,6 @@ use strict; use Carp; -use UNIVERSAL qw(can); use vars qw($VERSION @Size_magic_numbers); $VERSION = sprintf("%d.%02d", q$Revision: 2.04 $ =~ /(\d+)\.(\d+)/); @@ -207,7 +206,7 @@ my($self, $html) = @_; croak "Usage: \$formatter->format(\$tree)" - unless defined $html and ref $html and can($html, 'tag'); + unless defined $html and ref $html and $html->can('tag'); if( $self->DEBUG() > 4 ) { print "Tree to format:\n"; @@ -228,9 +227,9 @@ if (ref $node) { $tag = $node->tag; $func = $tag . '_' . ($start ? "start" : "end"); - # Use UNIVERSAL::can so that we can recover if + # Use ->can so that we can recover if # a handler is not defined for the tag. - if (can($self, $func)) { + if ($self->can($func)) { DEBUG > 3 and print ' ' x $depth, "Calling $func\n"; return $self->$func($node); } else {
I've picked up maintenance of this module. Theres a test release (currently 2.04.02) which has this fixed. Hopefully a release with this sorted should come out very soon.
Fixed in 2.05