perl/perl-update-Module-Pluggable.patch

965 lines
32 KiB
Diff
Raw Normal View History

This patch is derived from the perl-5.10.1 tarball as released on the CPAN.
diff -urN perl-5.10.0.orig/lib/Devel/InnerPackage.pm perl-5.10.0/lib/Devel/InnerPackage.pm
--- perl-5.10.0.orig/lib/Devel/InnerPackage.pm 2007-12-18 02:47:07.000000000 -0800
+++ perl-5.10.0/lib/Devel/InnerPackage.pm 2009-08-31 19:47:24.444773931 -0700
@@ -17,7 +17,7 @@
=head1 SYNOPSIS
use Foo::Bar;
- use Devel::innerPackage qw(list_packages);
+ use Devel::InnerPackage qw(list_packages);
my @inner_packages = list_packages('Foo::Bar');
@@ -75,7 +75,7 @@
!__PACKAGE__->_loaded($pack.$cand); # or @children;
push @packs, @children;
}
- return grep {$_ !~ /::::ISA::CACHE/} @packs;
+ return grep {$_ !~ /::(::ISA::CACHE|SUPER)/} @packs;
}
### XXX this is an inlining of the Class-Inspector->loaded()
diff -urN perl-5.10.0.orig/lib/Module/Pluggable/Object.pm perl-5.10.0/lib/Module/Pluggable/Object.pm
--- perl-5.10.0.orig/lib/Module/Pluggable/Object.pm 2007-12-18 02:47:07.000000000 -0800
+++ perl-5.10.0/lib/Module/Pluggable/Object.pm 2009-08-31 19:47:24.446771196 -0700
@@ -6,10 +6,9 @@
use File::Spec::Functions qw(splitdir catdir curdir catfile abs2rel);
use Carp qw(croak carp);
use Devel::InnerPackage;
-use Data::Dumper;
use vars qw($VERSION);
-$VERSION = '3.6';
+$VERSION = '3.9';
sub new {
@@ -20,6 +19,10 @@
}
+### Eugggh, this code smells
+### This is what happens when you keep adding patches
+### *sigh*
+
sub plugins {
my $self = shift;
@@ -30,14 +33,14 @@
my $filename = $self->{'filename'};
my $pkg = $self->{'package'};
+ # Get the exception params instantiated
+ $self->_setup_exceptions;
+
# automatically turn a scalar search path or namespace into a arrayref
for (qw(search_path search_dirs)) {
$self->{$_} = [ $self->{$_} ] if exists $self->{$_} && !ref($self->{$_});
}
-
-
-
# default search path is '<Module>::<Name>::Plugin'
$self->{'search_path'} = ["${pkg}::Plugin"] unless $self->{'search_path'};
@@ -46,13 +49,14 @@
# check to see if we're running under test
- my @SEARCHDIR = exists $INC{"blib.pm"} && $filename =~ m!(^|/)blib/! ? grep {/blib/} @INC : @INC;
+ my @SEARCHDIR = exists $INC{"blib.pm"} && defined $filename && $filename =~ m!(^|/)blib/! ? grep {/blib/} @INC : @INC;
# add any search_dir params
unshift @SEARCHDIR, @{$self->{'search_dirs'}} if defined $self->{'search_dirs'};
my @plugins = $self->search_directories(@SEARCHDIR);
+ push(@plugins, $self->handle_innerpackages($_)) for @{$self->{'search_path'}};
# push @plugins, map { print STDERR "$_\n"; $_->require } list_packages($_) for (@{$self->{'search_path'}});
@@ -60,43 +64,12 @@
return () unless @plugins;
- # exceptions
- my %only;
- my %except;
- my $only;
- my $except;
-
- if (defined $self->{'only'}) {
- if (ref($self->{'only'}) eq 'ARRAY') {
- %only = map { $_ => 1 } @{$self->{'only'}};
- } elsif (ref($self->{'only'}) eq 'Regexp') {
- $only = $self->{'only'}
- } elsif (ref($self->{'only'}) eq '') {
- $only{$self->{'only'}} = 1;
- }
- }
-
-
- if (defined $self->{'except'}) {
- if (ref($self->{'except'}) eq 'ARRAY') {
- %except = map { $_ => 1 } @{$self->{'except'}};
- } elsif (ref($self->{'except'}) eq 'Regexp') {
- $except = $self->{'except'}
- } elsif (ref($self->{'except'}) eq '') {
- $except{$self->{'except'}} = 1;
- }
- }
-
# remove duplicates
# probably not necessary but hey ho
my %plugins;
for(@plugins) {
- next if (keys %only && !$only{$_} );
- next unless (!defined $only || m!$only! );
-
- next if (keys %except && $except{$_} );
- next if (defined $except && m!$except! );
+ next unless $self->_is_legit($_);
$plugins{$_} = 1;
}
@@ -112,6 +85,58 @@
}
+sub _setup_exceptions {
+ my $self = shift;
+
+ my %only;
+ my %except;
+ my $only;
+ my $except;
+
+ if (defined $self->{'only'}) {
+ if (ref($self->{'only'}) eq 'ARRAY') {
+ %only = map { $_ => 1 } @{$self->{'only'}};
+ } elsif (ref($self->{'only'}) eq 'Regexp') {
+ $only = $self->{'only'}
+ } elsif (ref($self->{'only'}) eq '') {
+ $only{$self->{'only'}} = 1;
+ }
+ }
+
+
+ if (defined $self->{'except'}) {
+ if (ref($self->{'except'}) eq 'ARRAY') {
+ %except = map { $_ => 1 } @{$self->{'except'}};
+ } elsif (ref($self->{'except'}) eq 'Regexp') {
+ $except = $self->{'except'}
+ } elsif (ref($self->{'except'}) eq '') {
+ $except{$self->{'except'}} = 1;
+ }
+ }
+ $self->{_exceptions}->{only_hash} = \%only;
+ $self->{_exceptions}->{only} = $only;
+ $self->{_exceptions}->{except_hash} = \%except;
+ $self->{_exceptions}->{except} = $except;
+
+}
+
+sub _is_legit {
+ my $self = shift;
+ my $plugin = shift;
+ my %only = %{$self->{_exceptions}->{only_hash}||{}};
+ my %except = %{$self->{_exceptions}->{except_hash}||{}};
+ my $only = $self->{_exceptions}->{only};
+ my $except = $self->{_exceptions}->{except};
+
+ return 0 if (keys %only && !$only{$plugin} );
+ return 0 unless (!defined $only || $plugin =~ m!$only! );
+
+ return 0 if (keys %except && $except{$plugin} );
+ return 0 if (defined $except && $plugin =~ m!$except! );
+
+ return 1;
+}
+
sub search_directories {
my $self = shift;
my @SEARCHDIR = @_;
@@ -121,7 +146,6 @@
foreach my $dir (@SEARCHDIR) {
push @plugins, $self->search_paths($dir);
}
-
return @plugins;
}
@@ -151,6 +175,8 @@
# parse the file to get the name
my ($name, $directory, $suffix) = fileparse($file, $file_regex);
+ next if (!$self->{include_editor_junk} && $self->_is_editor_junk($name));
+
$directory = abs2rel($directory, $sp);
# If we have a mixed-case package name, assume case has been preserved
@@ -203,17 +229,34 @@
# now add stuff that may have been in package
# NOTE we should probably use all the stuff we've been given already
# but then we can't unload it :(
- push @plugins, $self->handle_innerpackages($searchpath) unless (exists $self->{inner} && !$self->{inner});
+ push @plugins, $self->handle_innerpackages($searchpath);
} # foreach $searchpath
return @plugins;
}
+sub _is_editor_junk {
+ my $self = shift;
+ my $name = shift;
+
+ # Emacs (and other Unix-y editors) leave temp files ending in a
+ # tilde as a backup.
+ return 1 if $name =~ /~$/;
+ # Emacs makes these files while a buffer is edited but not yet
+ # saved.
+ return 1 if $name =~ /^\.#/;
+ # Vim can leave these files behind if it crashes.
+ return 1 if $name =~ /\.sw[po]$/;
+
+ return 0;
+}
+
sub handle_finding_plugin {
my $self = shift;
my $plugin = shift;
return unless (defined $self->{'instantiate'} || $self->{'require'});
+ return unless $self->_is_legit($plugin);
$self->_require($plugin);
}
@@ -245,10 +288,11 @@
sub handle_innerpackages {
my $self = shift;
+ return () if (exists $self->{inner} && !$self->{inner});
+
my $path = shift;
my @plugins;
-
foreach my $plugin (Devel::InnerPackage::list_packages($path)) {
my $err = $self->handle_finding_plugin($plugin);
#next if $err;
@@ -299,6 +343,14 @@
Optionally it instantiates those classes for you.
+This object is wrapped by C<Module::Pluggable>. If you want to do something
+odd or add non-general special features you're probably best to wrap this
+and produce your own subclass.
+
+=head1 OPTIONS
+
+See the C<Module::Pluggable> docs.
+
=head1 AUTHOR
Simon Wistow <simon@thegestalt.org>
diff -urN perl-5.10.0.orig/lib/Module/Pluggable.pm perl-5.10.0/lib/Module/Pluggable.pm
--- perl-5.10.0.orig/lib/Module/Pluggable.pm 2007-12-18 02:47:07.000000000 -0800
+++ perl-5.10.0/lib/Module/Pluggable.pm 2009-08-31 19:47:24.448771465 -0700
@@ -9,7 +9,7 @@
# Peter Gibbons: I wouldn't say I've been missing it, Bob!
-$VERSION = '3.6';
+$VERSION = '3.9';
sub import {
my $class = shift;
@@ -60,8 +60,9 @@
no strict 'refs';
- no warnings 'redefine';
- *{"$package\::$sub"} = $subroutine;
+ no warnings qw(redefine prototype);
+
+ *{"$package\::$sub"} = $subroutine;
*{"$package\::search_path"} = $searchsub;
*{"$package\::only"} = $onlysub;
*{"$package\::except"} = $exceptsub;
@@ -297,6 +298,14 @@
file_regex => qr/\.plugin$/
+=head2 include_editor_junk
+
+By default C<Module::Pluggable> ignores files that look like they were
+left behind by editors. Currently this means files ending in F<~> (~),
+the extensions F<.swp> or F<.swo>, or files beginning with F<.#>.
+
+Setting C<include_editor_junk> changes C<Module::Pluggable> so it does
+not ignore any files it finds.
=head1 METHODs
diff -urN perl-5.10.0.orig/MANIFEST perl-5.10.0/MANIFEST
--- perl-5.10.0.orig/MANIFEST 2007-12-18 02:47:07.000000000 -0800
+++ perl-5.10.0/MANIFEST 2009-08-31 19:47:24.452770885 -0700
@@ -3612,11 +3612,14 @@
t/Module_Pluggable/09require.t Module::Pluggable tests
t/Module_Pluggable/10innerpack_inner.t Module::Pluggable tests
t/Module_Pluggable/10innerpack_noinner.t Module::Pluggable tests
+t/Module_Pluggable/10innerpack_onefile.t Module::Pluggable tests
t/Module_Pluggable/10innerpack_override.t Module::Pluggable tests
+t/Module_Pluggable/10innerpack_super.t Module::Pluggable tests
t/Module_Pluggable/10innerpack.t Module::Pluggable tests
t/Module_Pluggable/11usetwice.t Module::Pluggable tests
t/Module_Pluggable/12onlyarray.t Module::Pluggable tests
t/Module_Pluggable/12onlyregex.t Module::Pluggable tests
+t/Module_Pluggable/12onlyrequire.t Module::Pluggable tests
t/Module_Pluggable/12only.t Module::Pluggable tests
t/Module_Pluggable/13exceptarray.t Module::Pluggable tests
t/Module_Pluggable/13exceptregex.t Module::Pluggable tests
@@ -3628,8 +3631,15 @@
t/Module_Pluggable/18skipped_package.t Module::Pluggable tests
t/Module_Pluggable/19can_ok_clobber.t Module::Pluggable tests
t/Module_Pluggable/20dodgy_files.t Module::Pluggable tests
+t/Module_Pluggable/21editor_junk.t Module::Pluggable tests
t/Module_Pluggable/acme/Acme/MyTest/Plugin/Foo.pm Module::Pluggable tests
t/Module_Pluggable/lib/Acme/MyTest/Plugin/Foo.pm Module::Pluggable tests
+t/Module_Pluggable/lib/Acme/Foo-Bar.pm Module::Pluggable tests
+t/Module_Pluggable/lib/EditorJunk/Plugin/Foo.pm Module::Pluggable tests
+t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm.swo Module::Pluggable tests
+t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm.swp Module::Pluggable tests
+t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm~ Module::Pluggable tests
+t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm Module::Pluggable tests
t/Module_Pluggable/lib/ExtTest/Plugin/Bar.plugin Module::Pluggable tests
t/Module_Pluggable/lib/ExtTest/Plugin/Foo.plugin Module::Pluggable tests
t/Module_Pluggable/lib/ExtTest/Plugin/Quux/Foo.plugin Module::Pluggable tests
@@ -3646,6 +3656,7 @@
t/Module_Pluggable/lib/OddTest/Plugin/-Dodgy.pm Module::Pluggable tests
t/Module_Pluggable/lib/OddTest/Plugin/Foo.pm Module::Pluggable tests
t/Module_Pluggable/lib/TA/C/A/I.pm Module::Pluggable tests
+t/Module_Pluggable/lib/Zot/.Zork.pm Module::Pluggable tests
t/mro/basic_01_c3.t mro tests
t/mro/basic_01_dfs.t mro tests
t/mro/basic_02_c3.t mro tests
diff -urN perl-5.10.0.orig/t/Module_Pluggable/02alsoworks.t perl-5.10.0/t/Module_Pluggable/02alsoworks.t
--- perl-5.10.0.orig/t/Module_Pluggable/02alsoworks.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/02alsoworks.t 2009-08-31 19:47:24.454770805 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 5;
my $foo;
diff -urN perl-5.10.0.orig/t/Module_Pluggable/02works.t perl-5.10.0/t/Module_Pluggable/02works.t
--- perl-5.10.0.orig/t/Module_Pluggable/02works.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/02works.t 2009-08-31 19:47:24.455771358 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 5;
my $foo;
diff -urN perl-5.10.0.orig/t/Module_Pluggable/03diffname.t perl-5.10.0/t/Module_Pluggable/03diffname.t
--- perl-5.10.0.orig/t/Module_Pluggable/03diffname.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/03diffname.t 2009-08-31 19:47:24.456771493 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 3;
my $foo;
diff -urN perl-5.10.0.orig/t/Module_Pluggable/04acmedir_single.t perl-5.10.0/t/Module_Pluggable/04acmedir_single.t
--- perl-5.10.0.orig/t/Module_Pluggable/04acmedir_single.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/04acmedir_single.t 2009-08-31 19:47:24.456771493 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 3;
diff -urN perl-5.10.0.orig/t/Module_Pluggable/04acmedir.t perl-5.10.0/t/Module_Pluggable/04acmedir.t
--- perl-5.10.0.orig/t/Module_Pluggable/04acmedir.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/04acmedir.t 2009-08-31 19:47:24.457771627 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 3;
diff -urN perl-5.10.0.orig/t/Module_Pluggable/04acmepath_single.t perl-5.10.0/t/Module_Pluggable/04acmepath_single.t
--- perl-5.10.0.orig/t/Module_Pluggable/04acmepath_single.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/04acmepath_single.t 2009-08-31 19:47:24.458773508 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 3;
diff -urN perl-5.10.0.orig/t/Module_Pluggable/04acmepath.t perl-5.10.0/t/Module_Pluggable/04acmepath.t
--- perl-5.10.0.orig/t/Module_Pluggable/04acmepath.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/04acmepath.t 2009-08-31 19:47:24.459772105 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 3;
diff -urN perl-5.10.0.orig/t/Module_Pluggable/05postpath.t perl-5.10.0/t/Module_Pluggable/05postpath.t
--- perl-5.10.0.orig/t/Module_Pluggable/05postpath.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/05postpath.t 2009-08-31 19:47:24.460771332 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 3;
diff -urN perl-5.10.0.orig/t/Module_Pluggable/06multipath.t perl-5.10.0/t/Module_Pluggable/06multipath.t
--- perl-5.10.0.orig/t/Module_Pluggable/06multipath.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/06multipath.t 2009-08-31 19:47:24.461771676 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 3;
diff -urN perl-5.10.0.orig/t/Module_Pluggable/07instantiate.t perl-5.10.0/t/Module_Pluggable/07instantiate.t
--- perl-5.10.0.orig/t/Module_Pluggable/07instantiate.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/07instantiate.t 2009-08-31 19:47:24.462772090 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 6;
my $foo;
@@ -26,7 +26,7 @@
use File::Spec::Functions qw(catdir);
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Module::Pluggable (search_path => ["MyTest::Extend::Plugin"], sub_name => 'booga', instantiate => 'new');
use Module::Pluggable (search_path => ["MyTest::Extend::Plugin"], sub_name => 'wooga', instantiate => 'nosomuchmethod');
diff -urN perl-5.10.0.orig/t/Module_Pluggable/08nothing.t perl-5.10.0/t/Module_Pluggable/08nothing.t
--- perl-5.10.0.orig/t/Module_Pluggable/08nothing.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/08nothing.t 2009-08-31 19:47:24.463771316 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 2;
diff -urN perl-5.10.0.orig/t/Module_Pluggable/09require.t perl-5.10.0/t/Module_Pluggable/09require.t
--- perl-5.10.0.orig/t/Module_Pluggable/09require.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/09require.t 2009-08-31 19:47:24.464771800 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 2;
my $t = MyTest->new();
diff -urN perl-5.10.0.orig/t/Module_Pluggable/10innerpack_inner.t perl-5.10.0/t/Module_Pluggable/10innerpack_inner.t
--- perl-5.10.0.orig/t/Module_Pluggable/10innerpack_inner.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/10innerpack_inner.t 2009-08-31 19:47:24.465771515 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 3;
diff -urN perl-5.10.0.orig/t/Module_Pluggable/10innerpack_noinner.t perl-5.10.0/t/Module_Pluggable/10innerpack_noinner.t
--- perl-5.10.0.orig/t/Module_Pluggable/10innerpack_noinner.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/10innerpack_noinner.t 2009-08-31 19:47:24.479772629 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 3;
diff -urN perl-5.10.0.orig/t/Module_Pluggable/10innerpack_onefile.t perl-5.10.0/t/Module_Pluggable/10innerpack_onefile.t
--- perl-5.10.0.orig/t/Module_Pluggable/10innerpack_onefile.t 1969-12-31 16:00:00.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/10innerpack_onefile.t 2009-08-31 19:47:24.480772134 -0700
@@ -0,0 +1,27 @@
+#!perl -wT
+
+use strict;
+use Test::More tests => 2;
+use Data::Dumper;
+
+my $mc = MyClass->new();
+my $mc2 = MyClass2->new();
+
+
+is_deeply([$mc->plugins], [qw(MyClass::Plugin::MyPlugin)], "Got inner plugin");
+is_deeply([$mc2->plugins], [], "Didn't get plugin");
+
+package MyClass::Plugin::MyPlugin;
+sub pretty { print "I am pretty" };
+
+package MyClass;
+use Module::Pluggable inner => 1;
+
+sub new { return bless {}, $_[0] }
+
+package MyClass2;
+use Module::Pluggable search_path => "MyClass::Plugin", inner => 0;
+
+sub new { return bless {}, $_[0] }
+1;
+
diff -urN perl-5.10.0.orig/t/Module_Pluggable/10innerpack_override.t perl-5.10.0/t/Module_Pluggable/10innerpack_override.t
--- perl-5.10.0.orig/t/Module_Pluggable/10innerpack_override.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/10innerpack_override.t 2009-08-31 19:47:24.481771501 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 3;
diff -urN perl-5.10.0.orig/t/Module_Pluggable/10innerpack_super.t perl-5.10.0/t/Module_Pluggable/10innerpack_super.t
--- perl-5.10.0.orig/t/Module_Pluggable/10innerpack_super.t 1969-12-31 16:00:00.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/10innerpack_super.t 2009-08-31 19:47:24.482771565 -0700
@@ -0,0 +1,29 @@
+#!perl -wT
+
+use Test::More tests => 3;
+use strict;
+use_ok('Devel::InnerPackage');
+Bar->whee;
+is_deeply([Devel::InnerPackage::list_packages("Bar")],[], "Don't pick up ::SUPER pseudo stash");
+is_deeply([Devel::InnerPackage::list_packages("Foo")],['Foo::Bar'], "Still pick up other inner package");
+
+package Foo;
+
+sub whee {
+ 1;
+}
+
+package Foo::Bar;
+
+sub whee {}
+
+package Bar;
+use base 'Foo';
+
+sub whee {
+ shift->SUPER::whee;
+ 2;
+}
+
+
+1;
diff -urN perl-5.10.0.orig/t/Module_Pluggable/10innerpack.t perl-5.10.0/t/Module_Pluggable/10innerpack.t
--- perl-5.10.0.orig/t/Module_Pluggable/10innerpack.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/10innerpack.t 2009-08-31 19:47:24.483771909 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 4;
diff -urN perl-5.10.0.orig/t/Module_Pluggable/11usetwice.t perl-5.10.0/t/Module_Pluggable/11usetwice.t
--- perl-5.10.0.orig/t/Module_Pluggable/11usetwice.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/11usetwice.t 2009-08-31 19:47:24.484771624 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 3;
my $foo;
diff -urN perl-5.10.0.orig/t/Module_Pluggable/12onlyarray.t perl-5.10.0/t/Module_Pluggable/12onlyarray.t
--- perl-5.10.0.orig/t/Module_Pluggable/12onlyarray.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/12onlyarray.t 2009-08-31 19:47:24.485772038 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 10;
{
diff -urN perl-5.10.0.orig/t/Module_Pluggable/12onlyregex.t perl-5.10.0/t/Module_Pluggable/12onlyregex.t
--- perl-5.10.0.orig/t/Module_Pluggable/12onlyregex.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/12onlyregex.t 2009-08-31 19:47:24.485772038 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 10;
{
diff -urN perl-5.10.0.orig/t/Module_Pluggable/12onlyrequire.t perl-5.10.0/t/Module_Pluggable/12onlyrequire.t
--- perl-5.10.0.orig/t/Module_Pluggable/12onlyrequire.t 1969-12-31 16:00:00.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/12onlyrequire.t 2009-08-31 19:47:24.505021273 -0700
@@ -0,0 +1,21 @@
+#!perl -w
+use strict;
+use FindBin;
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
+use Test::More tests => 2;
+
+my @packages = eval { Zot->_dist_types };
+is($@, '', "No warnings");
+is(scalar(@packages), 0, "Correctly only got 1 package");
+
+
+package Zot;
+use strict;
+use Module::Pluggable (
+ sub_name => '_dist_types',
+ search_path => __PACKAGE__,
+ only => qr/Zot::\w+$/,
+ require => 1,
+ );
+
+1;
diff -urN perl-5.10.0.orig/t/Module_Pluggable/12only.t perl-5.10.0/t/Module_Pluggable/12only.t
--- perl-5.10.0.orig/t/Module_Pluggable/12only.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/12only.t 2009-08-31 19:47:24.506022385 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 10;
{
diff -urN perl-5.10.0.orig/t/Module_Pluggable/13exceptarray.t perl-5.10.0/t/Module_Pluggable/13exceptarray.t
--- perl-5.10.0.orig/t/Module_Pluggable/13exceptarray.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/13exceptarray.t 2009-08-31 19:47:24.507021263 -0700
@@ -1,8 +1,8 @@
-#!perl -w
+#!perl -wT
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 10;
{
diff -urN perl-5.10.0.orig/t/Module_Pluggable/13exceptregex.t perl-5.10.0/t/Module_Pluggable/13exceptregex.t
--- perl-5.10.0.orig/t/Module_Pluggable/13exceptregex.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/13exceptregex.t 2009-08-31 19:47:24.510021945 -0700
@@ -1,8 +1,8 @@
-#!perl -w
+#!perl -wT
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 10;
{
diff -urN perl-5.10.0.orig/t/Module_Pluggable/13except.t perl-5.10.0/t/Module_Pluggable/13except.t
--- perl-5.10.0.orig/t/Module_Pluggable/13except.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/13except.t 2009-08-31 19:47:24.511021381 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 10;
{
diff -urN perl-5.10.0.orig/t/Module_Pluggable/14package.t perl-5.10.0/t/Module_Pluggable/14package.t
--- perl-5.10.0.orig/t/Module_Pluggable/14package.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/14package.t 2009-08-31 19:47:24.842414378 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 5;
my $foo;
diff -urN perl-5.10.0.orig/t/Module_Pluggable/15topicsafe.t perl-5.10.0/t/Module_Pluggable/15topicsafe.t
--- perl-5.10.0.orig/t/Module_Pluggable/15topicsafe.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/15topicsafe.t 2009-08-31 19:47:24.842774343 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More 'no_plan';
use Module::Pluggable search_path => 'Acme::MyTest';
diff -urN perl-5.10.0.orig/t/Module_Pluggable/16different_extension.t perl-5.10.0/t/Module_Pluggable/16different_extension.t
--- perl-5.10.0.orig/t/Module_Pluggable/16different_extension.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/16different_extension.t 2009-08-31 19:47:24.843800947 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 5;
my $foo;
diff -urN perl-5.10.0.orig/t/Module_Pluggable/17devel_inner_package.t perl-5.10.0/t/Module_Pluggable/17devel_inner_package.t
--- perl-5.10.0.orig/t/Module_Pluggable/17devel_inner_package.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/17devel_inner_package.t 2009-08-31 19:47:24.843800947 -0700
@@ -3,7 +3,7 @@
use Devel::InnerPackage qw(list_packages);
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
my @packages;
diff -urN perl-5.10.0.orig/t/Module_Pluggable/18skipped_package.t perl-5.10.0/t/Module_Pluggable/18skipped_package.t
--- perl-5.10.0.orig/t/Module_Pluggable/18skipped_package.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/18skipped_package.t 2009-08-31 19:47:24.844780129 -0700
@@ -2,7 +2,7 @@
use Test::More tests => 1;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Devel::InnerPackage qw(list_packages);
use No::Middle;
diff -urN perl-5.10.0.orig/t/Module_Pluggable/19can_ok_clobber.t perl-5.10.0/t/Module_Pluggable/19can_ok_clobber.t
--- perl-5.10.0.orig/t/Module_Pluggable/19can_ok_clobber.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/19can_ok_clobber.t 2009-08-31 19:47:24.844780129 -0700
@@ -3,7 +3,7 @@
use warnings;
use Data::Dumper;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests=>5;
diff -urN perl-5.10.0.orig/t/Module_Pluggable/20dodgy_files.t perl-5.10.0/t/Module_Pluggable/20dodgy_files.t
--- perl-5.10.0.orig/t/Module_Pluggable/20dodgy_files.t 2007-12-18 02:47:08.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/20dodgy_files.t 2009-08-31 19:47:24.845769158 -0700
@@ -1,7 +1,7 @@
#!perl -w
BEGIN {
- if ($^O eq 'VMS') {
+ if ($^O eq 'VMS' || $^O eq 'VOS') {
print "1..0 # Skip: can't handle misspelled plugin names\n";
exit;
}
@@ -9,8 +9,18 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
-use Test::More tests => 5;
+use Test::More;
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
+use File::Spec::Functions qw(catfile);
+
+
+my ($dodgy_file) = (catfile($FindBin::Bin, "lib", "OddTest", "Plugin", "-Dodgy.pm")=~/^(.*)$/);
+unless (-f $dodgy_file) {
+ plan skip_all => "Can't handle misspelled plugin names\n";
+} else {
+ plan tests => 5;
+}
+
my $foo;
ok($foo = OddTest->new());
diff -urN perl-5.10.0.orig/t/Module_Pluggable/21editor_junk.t perl-5.10.0/t/Module_Pluggable/21editor_junk.t
--- perl-5.10.0.orig/t/Module_Pluggable/21editor_junk.t 1969-12-31 16:00:00.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/21editor_junk.t 2009-08-31 19:47:24.845769158 -0700
@@ -0,0 +1,53 @@
+#!perl -w
+
+use Test::More;
+use FindBin;
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
+use Module::Pluggable::Object;
+use File::Spec::Functions qw(catfile);
+
+my ($dodgy_file) = (catfile($FindBin::Bin,"lib", "EditorJunk", "Plugin", "#Bar.pm#")=~/^(.*)$/);
+unless (-f $dodgy_file) {
+ plan skip_all => "Can't handle plugin names with octothorpes\n";
+} else {
+ plan tests => 4;
+}
+
+
+
+my $foo;
+ok($foo = EditorJunk->new());
+
+my @plugins;
+my @expected = qw(EditorJunk::Plugin::Bar EditorJunk::Plugin::Foo);
+ok(@plugins = sort $foo->plugins);
+
+is_deeply(\@plugins, \@expected, "is deeply");
+
+
+my $mpo = Module::Pluggable::Object->new(
+ package => 'EditorJunk',
+ filename => __FILE__,
+ include_editor_junk => 1,
+);
+
+@expected = ('EditorJunk::Plugin::.#Bar', 'EditorJunk::Plugin::Bar', 'EditorJunk::Plugin::Foo');
+@plugins = sort $mpo->plugins();
+is_deeply(\@plugins, \@expected, "is deeply");
+
+
+
+package EditorJunk;
+
+use strict;
+use Module::Pluggable;
+
+
+sub new {
+ my $class = shift;
+ return bless {}, $class;
+
+}
+1;
+
+
diff -urN perl-5.10.0.orig/t/Module_Pluggable/lib/Acme/Foo-Bar.pm perl-5.10.0/t/Module_Pluggable/lib/Acme/Foo-Bar.pm
--- perl-5.10.0.orig/t/Module_Pluggable/lib/Acme/Foo-Bar.pm 1969-12-31 16:00:00.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/lib/Acme/Foo-Bar.pm 2009-08-31 19:47:24.845769158 -0700
@@ -0,0 +1,6 @@
+package Acme::FooBar;
+
+our $quux = "hello";
+
+1;
+
diff -urN perl-5.10.0.orig/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm perl-5.10.0/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm
--- perl-5.10.0.orig/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm 1969-12-31 16:00:00.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm 2009-08-31 19:47:24.846769084 -0700
@@ -0,0 +1,9 @@
+package EditorJunk::Bar;
+
+
+use strict;
+
+
+1;
+
+
diff -urN perl-5.10.0.orig/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm~ perl-5.10.0/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm~
--- perl-5.10.0.orig/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm~ 1969-12-31 16:00:00.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm~ 2009-08-31 19:47:24.851770803 -0700
@@ -0,0 +1,9 @@
+package EditorJunk::Bar;
+
+
+use strict;
+
+
+1;
+
+
diff -urN perl-5.10.0.orig/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm.swo perl-5.10.0/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm.swo
--- perl-5.10.0.orig/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm.swo 1969-12-31 16:00:00.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm.swo 2009-08-31 19:47:24.852771985 -0700
@@ -0,0 +1,9 @@
+package EditorJunk::Bar;
+
+
+use strict;
+
+
+1;
+
+
diff -urN perl-5.10.0.orig/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm.swp perl-5.10.0/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm.swp
--- perl-5.10.0.orig/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm.swp 1969-12-31 16:00:00.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm.swp 2009-08-31 19:47:24.853771770 -0700
@@ -0,0 +1,9 @@
+package EditorJunk::Bar;
+
+
+use strict;
+
+
+1;
+
+
diff -urN perl-5.10.0.orig/t/Module_Pluggable/lib/EditorJunk/Plugin/Foo.pm perl-5.10.0/t/Module_Pluggable/lib/EditorJunk/Plugin/Foo.pm
--- perl-5.10.0.orig/t/Module_Pluggable/lib/EditorJunk/Plugin/Foo.pm 1969-12-31 16:00:00.000000000 -0800
+++ perl-5.10.0/t/Module_Pluggable/lib/EditorJunk/Plugin/Foo.pm 2009-08-31 19:47:24.854771835 -0700
@@ -0,0 +1,9 @@
+package EditorJunk::Foo;
+
+
+use strict;
+
+
+1;
+
+