Skip Menu |

This queue is for tickets about the Class-STL-Containers CPAN distribution.

Report information
The Basics
Id: 88547
Status: resolved
Priority: 0/
Queue: Class-STL-Containers

People
Owner: Nobody in particular
Requestors: nick [...] ccl4.org
Cc:
AdminCc:

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



Subject: No need to use UNIVERSAL to get ->can and ->isa
Various packages in Class-STL-Algorithms contain the line use UNIVERSAL qw(isa can); but none actually rely on isa() or can() being imported to the current package. The code only calls them as class methods, or fully qualified as UNIVERSAL::can(). Both cases are built into the core, and so work without loading the module. Moreover, importing from UNIVERSAL is deprecated, and has warned since v5.12.0. With the previous bug fixed, the test suite still looks rather ugly: t/Class-STL-Algorithms.t ................ UNIVERSAL->import is deprecated and will be removed in a future perl at /Volumes/Stuff/Perl/Class-STL-Containers-0.35/lib/Class/STL/ClassMembers.pm line 38. UNIVERSAL->import is deprecated and will be removed in a future perl at /Volumes/Stuff/Perl/Class-STL-Containers-0.35/lib/Class/STL/Trace.pm line 39. UNIVERSAL->import is deprecated and will be removed in a future perl at /Volumes/Stuff/Perl/Class-STL-Containers-0.35/lib/Class/STL/Element.pm line 41. UNIVERSAL->import is deprecated and will be removed in a future perl at /Volumes/Stuff/Perl/Class-STL-Containers-0.35/lib/Class/STL/Containers.pm line 62. UNIVERSAL->import is deprecated and will be removed in a future perl at /Volumes/Stuff/Perl/Class-STL-Containers-0.35/lib/Class/STL/Containers.pm line 638. UNIVERSAL->import is deprecated and will be removed in a future perl at /Volumes/Stuff/Perl/Class-STL-Containers-0.35/lib/Class/STL/Algorithms.pm line 39. Patch attached which fixes this. Nicholas Clark
Subject: CSTLC.patch
--- lib/Class/STL/Algorithms.pm~ 2013-09-09 17:58:47.000000000 +0200 +++ lib/Class/STL/Algorithms.pm 2013-09-09 20:17:49.000000000 +0200 @@ -36,7 +36,6 @@ # ---------------------------------------------------------------------------------------------------- { package Class::STL::Algorithms; - use UNIVERSAL qw(isa can); use vars qw( @ISA @EXPORT_OK %EXPORT_TAGS ); require Exporter; @ISA = 'Exporter'; --- lib/Class/STL/ClassMembers.pm~ 2007-01-18 11:06:33.000000000 +0100 +++ lib/Class/STL/ClassMembers.pm 2013-09-09 20:17:57.000000000 +0200 @@ -35,7 +35,6 @@ # ---------------------------------------------------------------------------------------------------- { package Class::STL::ClassMembers; - use UNIVERSAL qw(isa can); use Carp qw(confess); use Class::STL::Trace; sub import --- lib/Class/STL/Containers.pm~ 2013-09-09 17:59:18.000000000 +0200 +++ lib/Class/STL/Containers.pm 2013-09-09 20:18:14.000000000 +0200 @@ -59,7 +59,6 @@ use base qw(Class::STL::Element); # container is also an element use overload '+' => 'append', '+=' => 'append', '=' => 'clone', '""' => 'str', '==' => 'eq', '!=' => 'ne'; use Class::STL::Iterators qw(:all); - use UNIVERSAL qw(isa can); use Carp qw(confess); use Class::STL::ClassMembers Class::STL::ClassMembers::DataMember->new( @@ -635,7 +634,6 @@ # ---------------------------------------------------------------------------------------------------- { package Class::STL::Containers::MakeFind; - use UNIVERSAL qw(isa can); use Carp qw(cluck confess); sub new # --> import... { --- lib/Class/STL/Element.pm~ 2007-01-18 11:06:42.000000000 +0100 +++ lib/Class/STL/Element.pm 2013-09-09 20:18:08.000000000 +0200 @@ -38,7 +38,6 @@ # ---------------------------------------------------------------------------------------------------- { package Class::STL::Element; - use UNIVERSAL qw(isa can); use Carp qw(confess); use Class::STL::ClassMembers qw( data ), Class::STL::ClassMembers::DataMember->new(name => 'data_type', default => 'string', --- lib/Class/STL/Trace.pm~ 2007-01-18 11:06:57.000000000 +0100 +++ lib/Class/STL/Trace.pm 2013-09-09 20:18:30.000000000 +0200 @@ -36,7 +36,6 @@ # ---------------------------------------------------------------------------------------------------- { package Class::STL::Trace; # Singleton - use UNIVERSAL qw(isa can); use Carp qw(confess); sub new { our $__class_stl_trace;
On 2013-09-09 14:23:27, nick@ccl4.org wrote: Show quoted text
> Various packages in Class-STL-Algorithms contain the line > > use UNIVERSAL qw(isa can); > > but none actually rely on isa() or can() being imported to the current > package. The code only calls them as class methods, or fully qualified > as UNIVERSAL::can(). Both cases are built into the core, and so work > without loading the module. Moreover, importing from UNIVERSAL is > deprecated, and has warned since v5.12.0. With the previous bug fixed, > the test suite still looks rather ugly: > > t/Class-STL-Algorithms.t ................ UNIVERSAL->import is > deprecated and will be removed in a future perl at > /Volumes/Stuff/Perl/Class-STL-Containers- > 0.35/lib/Class/STL/ClassMembers.pm line 38. > UNIVERSAL->import is deprecated and will be removed in a future perl > at /Volumes/Stuff/Perl/Class-STL-Containers- > 0.35/lib/Class/STL/Trace.pm line 39. > UNIVERSAL->import is deprecated and will be removed in a future perl > at /Volumes/Stuff/Perl/Class-STL-Containers- > 0.35/lib/Class/STL/Element.pm line 41. > UNIVERSAL->import is deprecated and will be removed in a future perl > at /Volumes/Stuff/Perl/Class-STL-Containers- > 0.35/lib/Class/STL/Containers.pm line 62. > UNIVERSAL->import is deprecated and will be removed in a future perl > at /Volumes/Stuff/Perl/Class-STL-Containers- > 0.35/lib/Class/STL/Containers.pm line 638. > UNIVERSAL->import is deprecated and will be removed in a future perl > at /Volumes/Stuff/Perl/Class-STL-Containers- > 0.35/lib/Class/STL/Algorithms.pm line 39. > > Patch attached which fixes this. > > Nicholas Clark
In newer perls this is a hard error: UNIVERSAL does not export anything at /tmpfs/.cpan-build/2015112815/Class-STL-Containers-0.35-8PRobo/lib/Class/STL/ClassMembers.pm line 38. BEGIN failed--compilation aborted at /tmpfs/.cpan-build/2015112815/Class-STL-Containers-0.35-8PRobo/lib/Class/STL/ClassMembers.pm line 38.
Fixed in 0.37