Subject: | Broken since 5.10.0 due to UNIVERSAL changes |
Class::STL::Contains fails most of its tests with v5.10.0 and later (ie stable releases for the past 5¾ years). This turns out to be due to this change in blead from a decade ago:
commit 2bfd56816acd10b1f958d1dde1769bafd756cbea
Author: Michael G. Schwern <schwern@pobox.com>
Date: Mon Oct 6 06:14:36 2003 -0700
Fixing UNIVERSAL.pm's bit of unpleasantness
Message-Id: <20031006131436.G20960@ttul.org>
p4raw-id: //depot/perl@21418
diff --git a/lib/UNIVERSAL.pm b/lib/UNIVERSAL.pm
index 7b7bfc4..c5f22eb 100644
--- a/lib/UNIVERSAL.pm
+++ b/lib/UNIVERSAL.pm
@@ -9,9 +9,15 @@ our $VERSION = '1.01';
# Exporter. It's bad enough that all classes have a import() method
# whenever UNIVERSAL.pm is loaded.
require Exporter;
-*import = \&Exporter::import;
@EXPORT_OK = qw(isa can VERSION);
+# Make sure that even though the import method is called, it doesn't do
+# anything unless its called on UNIVERSAL
+sub import {
+ return unless $_[0] eq __PACKAGE__;
+ goto &Exporter::import;
+}
+
1;
__END__
The problem is that the 5 packages in the distribution which were exporting subroutines had been relying on a misfeature of loading Universal to provide Exporter functionality. The C<use Exporter> line was (and always has been) a beguiling no-op - as Exporter documents, you need to inherit from it. (More recent Exporters let you import Exporter::import, but that won't fly with 5.6.x)
Patch attached that fixes the bug.
Note, I have given the bug a severity of "critical" because the module is useless without this fix. But given that the bug has neither been reported nor fixed in the past decade, I also suspect that it is of no urgency to anyone to fix it.
Nicholas Clark
Subject: | CSTLC.patch |
--- lib/Class/STL/Algorithms.pm~ 2007-03-30 10:00:04.000000000 +0200
+++ lib/Class/STL/Algorithms.pm 2013-09-09 17:58:47.000000000 +0200
@@ -37,8 +37,9 @@
{
package Class::STL::Algorithms;
use UNIVERSAL qw(isa can);
- use vars qw( @EXPORT_OK %EXPORT_TAGS );
- use Exporter;
+ use vars qw( @ISA @EXPORT_OK %EXPORT_TAGS );
+ require Exporter;
+ @ISA = 'Exporter';
my @export_names = qw(
find
find_if
--- lib/Class/STL/Containers.pm~ 2007-04-03 11:41:59.000000000 +0200
+++ lib/Class/STL/Containers.pm 2013-09-09 17:59:18.000000000 +0200
@@ -30,8 +30,9 @@
require 5.005_62;
use strict;
use warnings;
-use vars qw( $VERSION $BUILD @EXPORT_OK %EXPORT_TAGS );
-use Exporter;
+use vars qw( $VERSION $BUILD @ISA @EXPORT_OK %EXPORT_TAGS );
+require Exporter;
+@ISA = 'Exporter';
@EXPORT_OK = qw( vector list deque queue priority_queue stack tree );
%EXPORT_TAGS = ( all => [qw( vector list deque queue priority_queue stack tree )] );
$VERSION = '0.35';
--- lib/Class/STL/Iterators.pm~ 2007-01-18 11:06:50.000000000 +0100
+++ lib/Class/STL/Iterators.pm 2013-09-09 17:59:42.000000000 +0200
@@ -30,8 +30,9 @@
require 5.005_62;
use strict;
use warnings;
-use vars qw( $VERSION $BUILD @EXPORT_OK %EXPORT_TAGS );
-use Exporter;
+use vars qw( $VERSION $BUILD @ISA @EXPORT_OK %EXPORT_TAGS );
+require Exporter;
+@ISA = 'Exporter';
my @export_names = qw(
iterator
bidirectional_iterator
--- lib/Class/STL/Utilities.pm~ 2007-01-18 11:07:03.000000000 +0100
+++ lib/Class/STL/Utilities.pm 2013-09-09 18:00:00.000000000 +0200
@@ -30,8 +30,9 @@
require 5.005_62;
use strict;
use warnings;
-use vars qw( $VERSION $BUILD @EXPORT_OK %EXPORT_TAGS );
-use Exporter;
+use vars qw( $VERSION $BUILD @ISA @EXPORT_OK %EXPORT_TAGS );
+require Exporter;
+@ISA = 'Exporter';
my @export_names = qw(
equal_to not_equal_to greater greater_equal less less_equal compare bind1st bind2nd
mem_fun ptr_fun ptr_fun_binary matches matches_ic logical_and logical_or
--- lib/stl.pm~ 2006-12-27 10:50:07.000000000 +0100
+++ lib/stl.pm 2013-09-09 17:58:37.000000000 +0200
@@ -29,8 +29,9 @@
require 5.005_62;
use strict;
use warnings;
-use vars qw( $VERSION $BUILD @EXPORT_OK %EXPORT_TAGS);
-use Exporter;
+use vars qw($VERSION $BUILD @ISA @EXPORT_OK %EXPORT_TAGS);
+require Exporter;
+@ISA = 'Exporter';
my @containers = qw(
vector list deque queue priority_queue stack tree
);