[perl-Module-Pluggable/f20] Do not ignore single-letter-named packages

Petr Pisar ppisar at fedoraproject.org
Mon Jan 6 08:06:12 UTC 2014


commit 7b53e50e45b9c4e7a298ce844e3e8c8ff969b603
Author: Petr Písař <ppisar at redhat.com>
Date:   Mon Jan 6 09:05:31 2014 +0100

    Do not ignore single-letter-named packages

 ...ble-4.8-Allow-single-letter-package-names.patch |   94 ++++++++++++++++++++
 perl-Module-Pluggable.spec                         |    9 ++-
 2 files changed, 102 insertions(+), 1 deletions(-)
---
diff --git a/Module-Pluggable-4.8-Allow-single-letter-package-names.patch b/Module-Pluggable-4.8-Allow-single-letter-package-names.patch
new file mode 100644
index 0000000..5cb7615
--- /dev/null
+++ b/Module-Pluggable-4.8-Allow-single-letter-package-names.patch
@@ -0,0 +1,94 @@
+From 7872bc27ac7f828a6b53d00717abdf83f2d1866d Mon Sep 17 00:00:00 2001
+From: Simon Wistow <simon at fastly.com>
+Date: Tue, 22 Oct 2013 09:32:27 -0700
+Subject: [PATCH] Allow single letter package names
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+---
+ lib/Module/Pluggable/Object.pm |  2 +-
+ t/25single_letter_package.t    | 42 ++++++++++++++++++++++++++++++++++++++++++
+ t/lib/M/X.pm                   |  7 +++++++
+ 3 files changed, 50 insertions(+), 1 deletion(-)
+ create mode 100755 t/25single_letter_package.t
+ create mode 100644 t/lib/M/X.pm
+
+diff --git a/lib/Module/Pluggable/Object.pm b/lib/Module/Pluggable/Object.pm
+index 6f7a051..46240a8 100755
+--- a/lib/Module/Pluggable/Object.pm
++++ b/lib/Module/Pluggable/Object.pm
+@@ -234,7 +234,7 @@ sub search_paths {
+             }
+             my $plugin = join '::', $searchpath, @dirs, $name;
+ 
+-            next unless $plugin =~ m!(?:[a-z\d]+)[a-z\d]!i;
++            next unless $plugin =~ m!(?:[a-z\d]+)[a-z\d]*!i;
+ 
+             $self->handle_finding_plugin($plugin, \@plugins)
+         }
+diff --git a/t/25single_letter_package.t b/t/25single_letter_package.t
+new file mode 100755
+index 0000000..dd55fff
+--- /dev/null
++++ b/t/25single_letter_package.t
+@@ -0,0 +1,42 @@
++#!perl -w
++
++use strict;
++use FindBin;
++use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
++use Test::More tests => 5;
++
++my $foo;
++ok($foo = M->new());
++
++my @plugins;
++my @expected = qw(M::X);
++ok(@plugins = sort $foo->plugins);
++
++
++
++is_deeply(\@plugins, \@expected, "is deeply");
++
++ at plugins = ();
++
++ok(@plugins = sort M->plugins);
++
++
++
++
++is_deeply(\@plugins, \@expected, "is deeply class");
++
++
++
++package M;
++
++use strict;
++use Module::Pluggable search_path => "M";
++
++
++sub new {
++    my $class = shift;
++    return bless {}, $class;
++
++}
++1;
++
+diff --git a/t/lib/M/X.pm b/t/lib/M/X.pm
+new file mode 100644
+index 0000000..77f8f58
+--- /dev/null
++++ b/t/lib/M/X.pm
+@@ -0,0 +1,7 @@
++package M::X;
++
++use strict;
++
++sub new { return bless {}, $_[0]; }
++sub frobnitz {}
++1;
+-- 
+1.8.3.1
+
diff --git a/perl-Module-Pluggable.spec b/perl-Module-Pluggable.spec
index c623b95..9cc3b64 100644
--- a/perl-Module-Pluggable.spec
+++ b/perl-Module-Pluggable.spec
@@ -4,12 +4,15 @@ Name:           perl-Module-Pluggable
 Epoch:          1
 # Keep two digit decimal part
 Version:        %{cpan_version}0
-Release:        291%{?dist}
+Release:        292%{?dist}
 Summary:        Automatically give your module the ability to have plugins
 License:        GPL+ or Artistic
 Group:          Development/Libraries
 URL:            http://search.cpan.org/dist/Module-Pluggable/
 Source0:        http://www.cpan.org/authors/id/S/SI/SIMONW/Module-Pluggable-%{cpan_version}.tar.gz
+# Do not ignore single-letter-named packages, bug #1048703, CPAN RT#89680,
+# fixed in 5.0.
+Patch0:         Module-Pluggable-4.8-Allow-single-letter-package-names.patch
 BuildArch:      noarch
 BuildRequires:  perl
 BuildRequires:  perl(FindBin)
@@ -49,6 +52,7 @@ into class names. Optionally it instantiates those classes for you.
 
 %prep
 %setup -q -n Module-Pluggable-%{cpan_version}
+%patch0 -p1
 find -type f -exec chmod -x {} +
 
 %build
@@ -68,6 +72,9 @@ perl Build.PL installdirs=vendor
 %{_mandir}/man3/*
 
 %changelog
+* Mon Jan 06 2014 Petr Pisar <ppisar at redhat.com> - 1:4.80-292
+- Do not ignore single-letter-named packages (bug #1048703)
+
 * Sat Aug 03 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1:4.80-291
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
 


More information about the scm-commits mailing list