Change 33527 by [EMAIL PROTECTED] on 2008/03/14 10:46:20
Integrate:
[ 33524]
Integrate:
[ 33499]
Move Module::Pluggable into ext/ as the next version has actions in its
Makefile.PL that we will need to run as part of a core build.
[ 33505]
Upgrade to Module::Pluggable 3.7
[ 33526]
Integrate:
[ 33242]
Cope with differing prototypes for ECONNREFUSED etc on Win32 between
5.8.x and 5.10.x
Affected files ...
... //depot/maint-5.8/perl/MANIFEST#425 integrate
... //depot/maint-5.8/perl/Porting/Maintainers.pl#39 integrate
... //depot/maint-5.8/perl/ext/Module/Pluggable/Makefile.PL#1 branch
... //depot/maint-5.8/perl/ext/Module/Pluggable/lib/Devel/InnerPackage.pm#1
branch
... //depot/maint-5.8/perl/ext/Module/Pluggable/lib/Module/Pluggable.pm#1 branch
...
//depot/maint-5.8/perl/ext/Module/Pluggable/lib/Module/Pluggable/Object.pm#1
branch
... //depot/maint-5.8/perl/lib/Devel/InnerPackage.pm#2 delete
... //depot/maint-5.8/perl/lib/Module/Pluggable.pm#3 delete
... //depot/maint-5.8/perl/lib/Module/Pluggable/Object.pm#3 delete
... //depot/maint-5.8/perl/lib/Net/Ping.pm#12 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/02alsoworks.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/02works.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/03diffname.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/04acmedir.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/04acmedir_single.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/04acmepath.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/04acmepath_single.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/05postpath.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/06multipath.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/07instantiate.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/08nothing.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/09require.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/10innerpack.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/10innerpack_inner.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/10innerpack_noinner.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/10innerpack_override.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/10innerpack_super.t#1 branch
... //depot/maint-5.8/perl/t/Module_Pluggable/11usetwice.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/12only.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/12onlyarray.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/12onlyregex.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/13except.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/13exceptarray.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/13exceptregex.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/14package.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/15topicsafe.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/16different_extension.t#2
integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/17devel_inner_package.t#2
integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/18skipped_package.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/19can_ok_clobber.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/20dodgy_files.t#2 integrate
... //depot/maint-5.8/perl/t/Module_Pluggable/21editor_junk.t#1 branch
... //depot/maint-5.8/perl/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm#1
branch
...
//depot/maint-5.8/perl/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm.swo#1
branch
...
//depot/maint-5.8/perl/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm.swp#1
branch
... //depot/maint-5.8/perl/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm~#1
branch
... //depot/maint-5.8/perl/t/Module_Pluggable/lib/EditorJunk/Plugin/Foo.pm#1
branch
... //depot/maint-5.8/perl/t/Module_Pluggable/lib/OddTest/Plugin/-Dodgy.pm#2
delete
Differences ...
==== //depot/maint-5.8/perl/MANIFEST#425 (text) ====
Index: perl/MANIFEST
--- perl/MANIFEST#424~33516~ 2008-03-13 12:37:42.000000000 -0700
+++ perl/MANIFEST 2008-03-14 03:46:20.000000000 -0700
@@ -729,6 +729,9 @@
ext/MIME/Base64/t/quoted-print.t See whether MIME::QuotedPrint works
ext/MIME/Base64/t/unicode.t See whether MIME::Base64 works
ext/MIME/Base64/t/warn.t See whether MIME::Base64 works
+ext/Module/Pluggable/lib/Devel/InnerPackage.pm Find inner packages
+ext/Module/Pluggable/lib/Module/Pluggable/Object.pm Module::Pluggable
+ext/Module/Pluggable/lib/Module/Pluggable.pm Module::Pluggable
ext/NDBM_File/hints/cygwin.pl Hint for NDBM_File for named architecture
ext/NDBM_File/hints/dec_osf.pl Hint for NDBM_File for named architecture
ext/NDBM_File/hints/dynixptx.pl Hint for NDBM_File for named
architecture
@@ -1453,7 +1456,6 @@
lib/dbm_filter_util.pl Utility functions used by DBM Filter tests
lib/DB.pm Debugger API (draft)
lib/DB.t See if DB works
-lib/Devel/InnerPackage.pm Find inner packages
lib/Devel/SelfStubber.pm Generate stubs for SelfLoader.pm
lib/Devel/SelfStubber.t See if Devel::SelfStubber works
lib/diagnostics.pm Print verbose diagnostics
@@ -1844,8 +1846,6 @@
lib/Module/CoreList.pm Module::CoreList
lib/Module/CoreList/t/corelist.t Module::CoreList
lib/Module/CoreList/t/find_modules.t Module::CoreList
-lib/Module/Pluggable/Object.pm Module::Pluggable
-lib/Module/Pluggable.pm Module::Pluggable
lib/Net/Changes libnet
lib/Net/Cmd.pm libnet
lib/Net/Config.eg libnet
@@ -2967,6 +2967,7 @@
t/Module_Pluggable/10innerpack_inner.t Module::Pluggable tests
t/Module_Pluggable/10innerpack_noinner.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
@@ -2982,8 +2983,14 @@
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/EditorJunk/Plugin/Foo.pm
Module::Pluggable tests
+t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm~ 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.swo 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
@@ -2997,7 +3004,6 @@
t/Module_Pluggable/lib/MyTest/Plugin/Foo.pm Module::Pluggable tests
t/Module_Pluggable/lib/MyTest/Plugin/Quux/Foo.pm Module::Pluggable tests
t/Module_Pluggable/lib/No/Middle.pm Module::Pluggable tests
-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
Todo.micro The Wishlist for microperl
==== //depot/maint-5.8/perl/Porting/Maintainers.pl#39 (text) ====
Index: perl/Porting/Maintainers.pl
--- perl/Porting/Maintainers.pl#38~33516~ 2008-03-13 12:37:42.000000000
-0700
+++ perl/Porting/Maintainers.pl 2008-03-14 03:46:20.000000000 -0700
@@ -526,8 +526,7 @@
'Module::Pluggable' =>
{
'MAINTAINER' => 'simonw',
- 'FILES' => q[lib/Module/Pluggable
lib/Module/Pluggable.pm
- lib/Devel/InnerPackage.pm
t/Module_Pluggable],
+ 'FILES' => q[ext/Module/Pluggable t/Module_Pluggable],
'CPAN' => 1,
},
==== //depot/maint-5.8/perl/ext/Module/Pluggable/Makefile.PL#1 (text) ====
Index: perl/ext/Module/Pluggable/Makefile.PL
--- /dev/null 2008-03-12 08:50:16.603989457 -0700
+++ perl/ext/Module/Pluggable/Makefile.PL 2008-03-14 03:46:20.000000000
-0700
@@ -0,0 +1,48 @@
+# Note: this file was auto-generated by Module::Build::Compat version 0.03
+use ExtUtils::MakeMaker;
+use FindBin;
+use File::Spec::Functions qw(catfile);
+
+# VOS and VMS can't handle dodgy plugin names
+# and VOS can't even unpack them so we create them on the
+# fly and only run the tests if they're present
+my %dodgy_files = (
+ catfile(qw(OddTest Plugin -Dodgy.pm)) => 'OddTest::Plugin::-Dodgy',
+ catfile(qw(EditorJunk Plugin #Bar.pm#)) => 'EditorJunk::Bar',
+ catfile(qw(EditorJunk Plugin .#Bar.pm)) => 'EditorJunk::Bar',
+);
+
+my $core = grep { $_ eq 'PERL_CORE=1' } @ARGV;
+my @path = $core ? (File::Spec->updir, File::Spec->updir, File::Spec->updir,
+ "t", "Module_Pluggable") : ($FindBin::Bin,"t");
+my @files;
+
+if ($^O ne 'VMS' && $^O ne 'VOS') {
+ foreach my $test (keys %dodgy_files) {
+ my ($file) = (catfile(@path, "lib", $test)=~/^(.*)$/);
+ if (open(my $fh, ">", $file)) {
+ my $name = $dodgy_files{$test};
+ print $fh "package $name;\nsub new {}\n1;";
+ close($fh);
+ push @files, $file;
+ }
+ }
+}
+
+WriteMakefile
+(
+ 'NAME' => 'Module::Pluggable',
+ 'VERSION_FROM' => 'lib/Module/Pluggable.pm',
+ 'PREREQ_PM' => {
+ 'File::Basename' => '0',
+ 'File::Spec' => '3.00',
+ 'Test::More' => '0.62'
+ },
+ 'INSTALLDIRS' => 'site',
+ 'EXE_FILES' => [],
+ 'PL_FILES' => {},
+ 'realclean' => {FILES=> join ' ', @files},
+ # In the core pods will be built by installman.
+ $core ? (MAN3PODS => {}) : (),
+ )
+;
==== //depot/maint-5.8/perl/ext/Module/Pluggable/lib/Devel/InnerPackage.pm#1
(text) ====
Index: perl/ext/Module/Pluggable/lib/Devel/InnerPackage.pm
--- /dev/null 2008-03-12 08:50:16.603989457 -0700
+++ perl/ext/Module/Pluggable/lib/Devel/InnerPackage.pm 2008-03-14
03:46:20.000000000 -0700
@@ -0,0 +1,128 @@
+package Devel::InnerPackage;
+
+use strict;
+use base qw(Exporter);
+use vars qw($VERSION @EXPORT_OK);
+
+$VERSION = '0.3';
[EMAIL PROTECTED] = qw(list_packages);
+
+=pod
+
+=head1 NAME
+
+
+Devel::InnerPackage - find all the inner packages of a package
+
+=head1 SYNOPSIS
+
+ use Foo::Bar;
+ use Devel::InnerPackage qw(list_packages);
+
+ my @inner_packages = list_packages('Foo::Bar');
+
+
+=head1 DESCRIPTION
+
+
+Given a file like this
+
+
+ package Foo::Bar;
+
+ sub foo {}
+
+
+ package Foo::Bar::Quux;
+
+ sub quux {}
+
+ package Foo::Bar::Quirka;
+
+ sub quirka {}
+
+ 1;
+
+then
+
+ list_packages('Foo::Bar');
+
+will return
+
+ Foo::Bar::Quux
+ Foo::Bar::Quirka
+
+=head1 METHODS
+
+=head2 list_packages <package name>
+
+Return a list of all inner packages of that package.
+
+=cut
+
+sub list_packages {
+ my $pack = shift; $pack .= "::" unless $pack =~ m!::$!;
+
+ no strict 'refs';
+ my @packs;
+ my @stuff = grep !/^(main|)::$/, keys %{$pack};
+ for my $cand (grep /::$/, @stuff)
+ {
+ $cand =~ s!::$!!;
+ my @children = list_packages($pack.$cand);
+
+ push @packs, "$pack$cand" unless $cand =~ /^::/ ||
+ !__PACKAGE__->_loaded($pack.$cand); # or @children;
+ push @packs, @children;
+ }
+ return grep {$_ !~ /::(::ISA::CACHE|SUPER)/} @packs;
+}
+
+### XXX this is an inlining of the Class-Inspector->loaded()
+### method, but inlined to remove the dependency.
+sub _loaded {
+ my ($class, $name) = @_;
+
+ no strict 'refs';
+
+ # Handle by far the two most common cases
+ # This is very fast and handles 99% of cases.
+ return 1 if defined ${"${name}::VERSION"};
+ return 1 if defined @{"${name}::ISA"};
+
+ # Are there any symbol table entries other than other namespaces
+ foreach ( keys %{"${name}::"} ) {
+ next if substr($_, -2, 2) eq '::';
+ return 1 if defined &{"${name}::$_"};
+ }
+
+ # No functions, and it doesn't have a version, and isn't anything.
+ # As an absolute last resort, check for an entry in %INC
+ my $filename = join( '/', split /(?:'|::)/, $name ) . '.pm';
+ return 1 if defined $INC{$filename};
+
+ '';
+}
+
+
+=head1 AUTHOR
+
+Simon Wistow <[EMAIL PROTECTED]>
+
+=head1 COPYING
+
+Copyright, 2005 Simon Wistow
+
+Distributed under the same terms as Perl itself.
+
+=head1 BUGS
+
+None known.
+
+=cut
+
+
+
+
+
+1;
==== //depot/maint-5.8/perl/ext/Module/Pluggable/lib/Module/Pluggable.pm#1
(text) ====
Index: perl/ext/Module/Pluggable/lib/Module/Pluggable.pm
--- /dev/null 2008-03-12 08:50:16.603989457 -0700
+++ perl/ext/Module/Pluggable/lib/Module/Pluggable.pm 2008-03-14
03:46:20.000000000 -0700
@@ -0,0 +1,355 @@
+package Module::Pluggable;
+
+use strict;
+use vars qw($VERSION);
+use Module::Pluggable::Object;
+
+# ObQuote:
+# Bob Porter: Looks like you've been missing a lot of work lately.
+# Peter Gibbons: I wouldn't say I've been missing it, Bob!
+
+
+$VERSION = '3.7';
+
+sub import {
+ my $class = shift;
+ my %opts = @_;
+
+ my ($pkg, $file) = caller;
+ # the default name for the method is 'plugins'
+ my $sub = $opts{'sub_name'} || 'plugins';
+ # get our package
+ my ($package) = $opts{'package'} || $pkg;
+ $opts{filename} = $file;
+ $opts{package} = $package;
+
+
+ my $finder = Module::Pluggable::Object->new(%opts);
+ my $subroutine = sub { my $self = shift; return $finder->plugins(@_) };
+
+ my $searchsub = sub {
+ my $self = shift;
+ my ($action,@paths) = @_;
+
+ $finder->{'search_path'} = ["${package}::Plugin"] if ($action eq
'add' and not $finder->{'search_path'} );
+ push @{$finder->{'search_path'}}, @paths if ($action eq
'add');
+ $finder->{'search_path'} = [EMAIL PROTECTED] if
($action eq 'new');
+ return $finder->{'search_path'};
+ };
+
+
+ my $onlysub = sub {
+ my ($self, $only) = @_;
+
+ if (defined $only) {
+ $finder->{'only'} = $only;
+ };
+
+ return $finder->{'only'};
+ };
+
+ my $exceptsub = sub {
+ my ($self, $except) = @_;
+
+ if (defined $except) {
+ $finder->{'except'} = $except;
+ };
+
+ return $finder->{'except'};
+ };
+
+
+ no strict 'refs';
+ no warnings qw(redefine prototype);
+
+ *{"$package\::$sub"} = $subroutine;
+ *{"$package\::search_path"} = $searchsub;
+ *{"$package\::only"} = $onlysub;
+ *{"$package\::except"} = $exceptsub;
+
+}
+
+1;
+
+=pod
+
+=head1 NAME
+
+Module::Pluggable - automatically give your module the ability to have plugins
+
+=head1 SYNOPSIS
+
+
+Simple use Module::Pluggable -
+
+ package MyClass;
+ use Module::Pluggable;
+
+
+and then later ...
+
+ use MyClass;
+ my $mc = MyClass->new();
+ # returns the names of all plugins installed under MyClass::Plugin::*
+ my @plugins = $mc->plugins();
+
+=head1 EXAMPLE
+
+Why would you want to do this? Say you have something that wants to pass an
+object to a number of different plugins in turn. For example you may
+want to extract meta-data from every email you get sent and do something
+with it. Plugins make sense here because then you can keep adding new
+meta data parsers and all the logic and docs for each one will be
+self contained and new handlers are easy to add without changing the
+core code. For that, you might do something like ...
+
+ package Email::Examiner;
+
+ use strict;
+ use Email::Simple;
+ use Module::Pluggable require => 1;
+
+ sub handle_email {
+ my $self = shift;
+ my $email = shift;
+
+ foreach my $plugin ($self->plugins) {
+ $plugin->examine($email);
+ }
+
+ return 1;
+ }
+
+
+
+.. and all the plugins will get a chance in turn to look at it.
+
+This can be trivally extended so that plugins could save the email
+somewhere and then no other plugin should try and do that.
+Simply have it so that the C<examine> method returns C<1> if
+it has saved the email somewhere. You might also wnat to be paranoid
+and check to see if the plugin has an C<examine> method.
+
+ foreach my $plugin ($self->plugins) {
+ next unless $plugin->can('examine');
+ last if $plugin->examine($email);
+ }
+
+
+And so on. The sky's the limit.
+
+
+=head1 DESCRIPTION
+
+Provides a simple but, hopefully, extensible way of having 'plugins' for
+your module. Obviously this isn't going to be the be all and end all of
+solutions but it works for me.
+
+Essentially all it does is export a method into your namespace that
+looks through a search path for .pm files and turn those into class names.
+
+Optionally it instantiates those classes for you.
+
+=head1 ADVANCED USAGE
+
+
+Alternatively, if you don't want to use 'plugins' as the method ...
+
+ package MyClass;
+ use Module::Pluggable sub_name => 'foo';
+
+
+and then later ...
+
+ my @plugins = $mc->foo();
+
+
+Or if you want to look in another namespace
+
+ package MyClass;
+ use Module::Pluggable search_path => ['Acme::MyClass::Plugin',
'MyClass::Extend'];
+
+or directory
+
+ use Module::Pluggable search_dirs => ['mylibs/Foo'];
+
+
+Or if you want to instantiate each plugin rather than just return the name
+
+ package MyClass;
+ use Module::Pluggable instantiate => 'new';
+
+and then
+
+ # whatever is passed to 'plugins' will be passed
+ # to 'new' for each plugin
+ my @plugins = $mc->plugins(@options);
+
+
+alternatively you can just require the module without instantiating it
+
+ package MyClass;
+ use Module::Pluggable require => 1;
+
+since requiring automatically searches inner packages, which may not be
desirable, you can turn this off
+
+
+ package MyClass;
+ use Module::Pluggable require => 1, inner => 0;
+
+
+You can limit the plugins loaded using the except option, either as a string,
+array ref or regex
+
+ package MyClass;
+ use Module::Pluggable except => 'MyClass::Plugin::Foo';
+
+or
+
+ package MyClass;
+ use Module::Pluggable except => ['MyClass::Plugin::Foo',
'MyClass::Plugin::Bar'];
+
+or
+
+ package MyClass;
+ use Module::Pluggable except => qr/^MyClass::Plugin::(Foo|Bar)$/;
+
+
+and similarly for only which will only load plugins which match.
+
+Remember you can use the module more than once
+
+ package MyClass;
+ use Module::Pluggable search_path => 'MyClass::Filters' sub_name =>
'filters';
+ use Module::Pluggable search_path => 'MyClass::Plugins' sub_name =>
'plugins';
+
+and then later ...
+
+ my @filters = $self->filters;
+ my @plugins = $self->plugins;
+
+=head1 INNER PACKAGES
+
+If you have, for example, a file B<lib/Something/Plugin/Foo.pm> that
+contains package definitions for both C<Something::Plugin::Foo> and
+C<Something::Plugin::Bar> then as long as you either have either
+the B<require> or B<instantiate> option set then we'll also find
+C<Something::Plugin::Bar>. Nifty!
+
+=head1 OPTIONS
+
+You can pass a hash of options when importing this module.
+
+The options can be ...
+
+=head2 sub_name
+
+The name of the subroutine to create in your namespace.
+
+By default this is 'plugins'
+
+=head2 search_path
+
+An array ref of namespaces to look in.
+
+=head2 search_dirs
+
+An array ref of directorys to look in before @INC.
+
+=head2 instantiate
+
+Call this method on the class. In general this will probably be 'new'
+but it can be whatever you want. Whatever arguments are passed to 'plugins'
+will be passed to the method.
+
+The default is 'undef' i.e just return the class name.
+
+=head2 require
+
+Just require the class, don't instantiate (overrides 'instantiate');
+
+=head2 inner
+
+If set to 0 will B<not> search inner packages.
+If set to 1 will override C<require>.
+
+=head2 only
+
+Takes a string, array ref or regex describing the names of the only plugins to
+return. Whilst this may seem perverse ... well, it is. But it also
+makes sense. Trust me.
+
+=head2 except
+
+Similar to C<only> it takes a description of plugins to exclude
+from returning. This is slightly less perverse.
+
+=head2 package
+
+This is for use by extension modules which build on C<Module::Pluggable>:
+passing a C<package> option allows you to place the plugin method in a
+different package other than your own.
+
+=head2 file_regex
+
+By default C<Module::Pluggable> only looks for I<.pm> files.
+
+By supplying a new C<file_regex> then you can change this behaviour e.g
+
+ 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
+
+=head2 search_path
+
+The method C<search_path> is exported into you namespace as well.
+You can call that at any time to change or replace the
+search_path.
+
+ $self->search_path( add => "New::Path" ); # add
+ $self->search_path( new => "New::Path" ); # replace
+
+
+
+=head1 FUTURE PLANS
+
+This does everything I need and I can't really think of any other
+features I want to add. Famous last words of course
+
+Recently tried fixed to find inner packages and to make it
+'just work' with PAR but there are still some issues.
+
+
+However suggestions (and patches) are welcome.
+
+=head1 AUTHOR
+
+Simon Wistow <[EMAIL PROTECTED]>
+
+=head1 COPYING
+
+Copyright, 2006 Simon Wistow
+
+Distributed under the same terms as Perl itself.
+
+=head1 BUGS
+
+None known.
+
+=head1 SEE ALSO
+
+L<File::Spec>, L<File::Find>, L<File::Basename>, L<Class::Factory::Util>,
L<Module::Pluggable::Ordered>
+
+=cut
+
+
====
//depot/maint-5.8/perl/ext/Module/Pluggable/lib/Module/Pluggable/Object.pm#1
(text) ====
Index: perl/ext/Module/Pluggable/lib/Module/Pluggable/Object.pm
--- /dev/null 2008-03-12 08:50:16.603989457 -0700
+++ perl/ext/Module/Pluggable/lib/Module/Pluggable/Object.pm 2008-03-14
03:46:20.000000000 -0700
@@ -0,0 +1,351 @@
+package Module::Pluggable::Object;
+
+use strict;
+use File::Find ();
+use File::Basename;
+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';
+
+
+sub new {
+ my $class = shift;
+ my %opts = @_;
+
+ return bless \%opts, $class;
+
+}
+
+### Eugggh, this code smells
+### This is what happens when you keep adding patches
+### *sigh*
+
+
+sub plugins {
+ my $self = shift;
+
+ # override 'require'
+ $self->{'require'} = 1 if $self->{'inner'};
+
+ my $filename = $self->{'filename'};
+ my $pkg = $self->{'package'};
+
+ # 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'};
+
+
+ #my %opts = %$self;
+
+
+ # check to see if we're running under test
+ 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, map { print STDERR "$_\n"; $_->require }
list_packages($_) for (@{$self->{'search_path'}});
+
+ # return blank unless we've found anything
+ 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! );
+ $plugins{$_} = 1;
+ }
+
+ # are we instantiating or requring?
+ if (defined $self->{'instantiate'}) {
+ my $method = $self->{'instantiate'};
+ return map { ($_->can($method)) ? $_->$method(@_) : () } keys
%plugins;
+ } else {
+ # no? just return the names
+ return keys %plugins;
+ }
+
+
+}
+
+sub search_directories {
+ my $self = shift;
+ my @SEARCHDIR = @_;
+
+ my @plugins;
+ # go through our @INC
+ foreach my $dir (@SEARCHDIR) {
+ push @plugins, $self->search_paths($dir);
+ }
+
+ return @plugins;
+}
+
+
+sub search_paths {
+ my $self = shift;
+ my $dir = shift;
+ my @plugins;
+
+ my $file_regex = $self->{'file_regex'} || qr/\.pm$/;
+
+
+ # and each directory in our search path
+ foreach my $searchpath (@{$self->{'search_path'}}) {
+ # create the search directory in a cross platform goodness way
+ my $sp = catdir($dir, (split /::/, $searchpath));
+
+ # if it doesn't exist or it's not a dir then skip it
+ next unless ( -e $sp && -d _ ); # Use the cached stat the second time
+
+ my @files = $self->find_files($sp);
+
+ # foreach one we've found
+ foreach my $file (@files) {
+ # untaint the file; accept .pm only
+ next unless ($file) = ($file =~ /(.*$file_regex)$/);
+ # 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
+ # correctly. Otherwise, root through the file to locate the
case-preserved
+ # version of the package name.
+ my @pkg_dirs = ();
+ if ( $name eq lc($name) || $name eq uc($name) ) {
+ my $pkg_file = catfile($sp, $directory, "$name$suffix");
+ open PKGFILE, "<$pkg_file" or die "search_paths: Can't open
$pkg_file: $!";
+ my $in_pod = 0;
+ while ( my $line = <PKGFILE> ) {
+ $in_pod = 1 if $line =~ m/^=\w/;
+ $in_pod = 0 if $line =~ /^=cut/;
+ next if ($in_pod || $line =~ /^=cut/); # skip pod text
+ next if $line =~ /^\s*#/; # and comments
+ if ( $line =~ m/^\s*package\s+(.*::)?($name)\s*;/i ) {
+ @pkg_dirs = split /::/, $1;
+ $name = $2;
+ last;
+ }
+ }
+ close PKGFILE;
+ }
+
+ # then create the class name in a cross platform way
+ $directory =~ s/^[a-z]://i if($^O =~ /MSWin32|dos/); #
remove volume
+ my @dirs = ();
+ if ($directory) {
+ ($directory) = ($directory =~ /(.*)/);
+ @dirs = grep(length($_), splitdir($directory))
+ unless $directory eq curdir();
+ for my $d (reverse @dirs) {
+ my $pkg_dir = pop @pkg_dirs;
+ last unless defined $pkg_dir;
+ $d =~ s/\Q$pkg_dir\E/$pkg_dir/i; # Correct case
+ }
+ } else {
+ $directory = "";
+ }
+ my $plugin = join '::', $searchpath, @dirs, $name;
+
+ next unless $plugin =~ m!(?:[a-z\d]+)[a-z\d]!i;
+
+ my $err = $self->handle_finding_plugin($plugin);
+ carp "Couldn't require $plugin : $err" if $err;
+
+ push @plugins, $plugin;
+ }
+
+ # 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});
+ } # 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'});
+ $self->_require($plugin);
+}
+
+sub find_files {
+ my $self = shift;
+ my $search_path = shift;
+ my $file_regex = $self->{'file_regex'} || qr/\.pm$/;
+
+
+ # find all the .pm files in it
+ # this isn't perfect and won't find multiple plugins per file
+ #my $cwd = Cwd::getcwd;
+ my @files = ();
+ { # for the benefit of perl 5.6.1's Find, localize topic
+ local $_;
+ File::Find::find( { no_chdir => 1,
+ wanted => sub {
+ # Inlined from File::Find::Rule C< name => '*.pm'
>
+ return unless $File::Find::name =~ /$file_regex/;
+ (my $path = $File::Find::name) =~ s#^\\./##;
+ push @files, $path;
+ }
+ }, $search_path );
+ }
+ #chdir $cwd;
+ return @files;
+
+}
+
+sub handle_innerpackages {
+ my $self = shift;
+ my $path = shift;
+ my @plugins;
+
+
+ foreach my $plugin (Devel::InnerPackage::list_packages($path)) {
+ my $err = $self->handle_finding_plugin($plugin);
+ #next if $err;
+ #next unless $INC{$plugin};
+ push @plugins, $plugin;
+ }
+ return @plugins;
+
+}
+
+
+sub _require {
+ my $self = shift;
+ my $pack = shift;
+ local $@;
+ eval "CORE::require $pack";
+ return $@;
+}
+
+
+1;
+
+=pod
+
+=head1 NAME
+
+Module::Pluggable::Object - automatically give your module the ability to have
plugins
+
+=head1 SYNOPSIS
+
+
+Simple use Module::Pluggable -
+
+ package MyClass;
+ use Module::Pluggable::Object;
+
+ my $finder = Module::Pluggable::Object->new(%opts);
+ print "My plugins are: ".join(", ", $finder->plugins)."\n";
+
+=head1 DESCRIPTION
+
+Provides a simple but, hopefully, extensible way of having 'plugins' for
+your module. Obviously this isn't going to be the be all and end all of
+solutions but it works for me.
+
+Essentially all it does is export a method into your namespace that
+looks through a search path for .pm files and turn those into class names.
+
+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 <[EMAIL PROTECTED]>
+
+=head1 COPYING
+
+Copyright, 2006 Simon Wistow
+
+Distributed under the same terms as Perl itself.
+
+=head1 BUGS
+
+None known.
+
+=head1 SEE ALSO
+
+L<Module::Pluggable>
+
+=cut
+
==== //depot/maint-5.8/perl/lib/Net/Ping.pm#12 (text) ====
Index: perl/lib/Net/Ping.pm
--- perl/lib/Net/Ping.pm#11~33173~ 2008-02-01 11:33:57.000000000 -0800
+++ perl/lib/Net/Ping.pm 2008-03-14 03:46:20.000000000 -0700
@@ -16,7 +16,7 @@
@ISA = qw(Exporter);
@EXPORT = qw(pingecho);
-$VERSION = "2.34";
+$VERSION = "2.35";
sub SOL_IP { 0; };
sub IP_TOS { 1; };
@@ -35,11 +35,20 @@
if ($^O =~ /Win32/i) {
# Hack to avoid this Win32 spewage:
# Your vendor has not defined POSIX macro ECONNREFUSED
- *ECONNREFUSED = sub() {10061;}; # "Unknown Error" Special Win32 Response?
- *ENOTCONN = sub() {10057;};
- *ECONNRESET = sub() {10054;};
- *EINPROGRESS = sub() {10036;};
- *EWOULDBLOCK = sub() {10035;};
+ my @pairs = (ECONNREFUSED => 10061, # "Unknown Error" Special Win32 Response?
+ ENOTCONN => 10057,
+ ECONNRESET => 10054,
+ EINPROGRESS => 10036,
+ EWOULDBLOCK => 10035,
+ );
+ while (my $name = shift @pairs) {
+ my $value = shift @pairs;
+ # When defined, these all are non-zero
+ unless (eval $name) {
+ no strict 'refs';
+ *{$name} = defined prototype \&{$name} ? sub () {$value} : sub {$value};
+ }
+ }
# $syn_forking = 1; # XXX possibly useful in < Win2K ?
};
==== //depot/maint-5.8/perl/t/Module_Pluggable/02alsoworks.t#2 (text) ====
Index: perl/t/Module_Pluggable/02alsoworks.t
--- perl/t/Module_Pluggable/02alsoworks.t#1~31162~ 2007-05-07
04:15:06.000000000 -0700
+++ perl/t/Module_Pluggable/02alsoworks.t 2008-03-14 03:46:20.000000000
-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;
==== //depot/maint-5.8/perl/t/Module_Pluggable/02works.t#2 (text) ====
Index: perl/t/Module_Pluggable/02works.t
--- perl/t/Module_Pluggable/02works.t#1~31162~ 2007-05-07 04:15:06.000000000
-0700
+++ perl/t/Module_Pluggable/02works.t 2008-03-14 03:46:20.000000000 -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;
==== //depot/maint-5.8/perl/t/Module_Pluggable/03diffname.t#2 (text) ====
Index: perl/t/Module_Pluggable/03diffname.t
--- perl/t/Module_Pluggable/03diffname.t#1~31162~ 2007-05-07
04:15:06.000000000 -0700
+++ perl/t/Module_Pluggable/03diffname.t 2008-03-14 03:46:20.000000000
-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;
==== //depot/maint-5.8/perl/t/Module_Pluggable/04acmedir.t#2 (text) ====
Index: perl/t/Module_Pluggable/04acmedir.t
--- perl/t/Module_Pluggable/04acmedir.t#1~31162~ 2007-05-07
04:15:06.000000000 -0700
+++ perl/t/Module_Pluggable/04acmedir.t 2008-03-14 03:46:20.000000000 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 3;
==== //depot/maint-5.8/perl/t/Module_Pluggable/04acmedir_single.t#2 (text) ====
Index: perl/t/Module_Pluggable/04acmedir_single.t
--- perl/t/Module_Pluggable/04acmedir_single.t#1~31162~ 2007-05-07
04:15:06.000000000 -0700
+++ perl/t/Module_Pluggable/04acmedir_single.t 2008-03-14 03:46:20.000000000
-0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 3;
==== //depot/maint-5.8/perl/t/Module_Pluggable/04acmepath.t#2 (text) ====
Index: perl/t/Module_Pluggable/04acmepath.t
--- perl/t/Module_Pluggable/04acmepath.t#1~31162~ 2007-05-07
04:15:06.000000000 -0700
+++ perl/t/Module_Pluggable/04acmepath.t 2008-03-14 03:46:20.000000000
-0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 3;
==== //depot/maint-5.8/perl/t/Module_Pluggable/04acmepath_single.t#2 (text) ====
Index: perl/t/Module_Pluggable/04acmepath_single.t
--- perl/t/Module_Pluggable/04acmepath_single.t#1~31162~ 2007-05-07
04:15:06.000000000 -0700
+++ perl/t/Module_Pluggable/04acmepath_single.t 2008-03-14 03:46:20.000000000
-0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 3;
==== //depot/maint-5.8/perl/t/Module_Pluggable/05postpath.t#2 (text) ====
Index: perl/t/Module_Pluggable/05postpath.t
--- perl/t/Module_Pluggable/05postpath.t#1~31162~ 2007-05-07
04:15:06.000000000 -0700
+++ perl/t/Module_Pluggable/05postpath.t 2008-03-14 03:46:20.000000000
-0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 3;
==== //depot/maint-5.8/perl/t/Module_Pluggable/06multipath.t#2 (text) ====
Index: perl/t/Module_Pluggable/06multipath.t
--- perl/t/Module_Pluggable/06multipath.t#1~31162~ 2007-05-07
04:15:06.000000000 -0700
+++ perl/t/Module_Pluggable/06multipath.t 2008-03-14 03:46:20.000000000
-0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 3;
==== //depot/maint-5.8/perl/t/Module_Pluggable/07instantiate.t#2 (text) ====
Index: perl/t/Module_Pluggable/07instantiate.t
--- perl/t/Module_Pluggable/07instantiate.t#1~31162~ 2007-05-07
04:15:06.000000000 -0700
+++ perl/t/Module_Pluggable/07instantiate.t 2008-03-14 03:46:20.000000000
-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');
==== //depot/maint-5.8/perl/t/Module_Pluggable/08nothing.t#2 (text) ====
Index: perl/t/Module_Pluggable/08nothing.t
--- perl/t/Module_Pluggable/08nothing.t#1~31162~ 2007-05-07
04:15:06.000000000 -0700
+++ perl/t/Module_Pluggable/08nothing.t 2008-03-14 03:46:20.000000000 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 2;
==== //depot/maint-5.8/perl/t/Module_Pluggable/09require.t#2 (text) ====
Index: perl/t/Module_Pluggable/09require.t
--- perl/t/Module_Pluggable/09require.t#1~31162~ 2007-05-07
04:15:06.000000000 -0700
+++ perl/t/Module_Pluggable/09require.t 2008-03-14 03:46:20.000000000 -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();
==== //depot/maint-5.8/perl/t/Module_Pluggable/10innerpack.t#2 (text) ====
Index: perl/t/Module_Pluggable/10innerpack.t
--- perl/t/Module_Pluggable/10innerpack.t#1~31162~ 2007-05-07
04:15:06.000000000 -0700
+++ perl/t/Module_Pluggable/10innerpack.t 2008-03-14 03:46:20.000000000
-0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 4;
==== //depot/maint-5.8/perl/t/Module_Pluggable/10innerpack_inner.t#2 (text) ====
Index: perl/t/Module_Pluggable/10innerpack_inner.t
--- perl/t/Module_Pluggable/10innerpack_inner.t#1~31162~ 2007-05-07
04:15:06.000000000 -0700
+++ perl/t/Module_Pluggable/10innerpack_inner.t 2008-03-14 03:46:20.000000000
-0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 3;
==== //depot/maint-5.8/perl/t/Module_Pluggable/10innerpack_noinner.t#2 (text)
====
Index: perl/t/Module_Pluggable/10innerpack_noinner.t
--- perl/t/Module_Pluggable/10innerpack_noinner.t#1~31162~ 2007-05-07
04:15:06.000000000 -0700
+++ perl/t/Module_Pluggable/10innerpack_noinner.t 2008-03-14
03:46:20.000000000 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 3;
==== //depot/maint-5.8/perl/t/Module_Pluggable/10innerpack_override.t#2 (text)
====
Index: perl/t/Module_Pluggable/10innerpack_override.t
--- perl/t/Module_Pluggable/10innerpack_override.t#1~31162~ 2007-05-07
04:15:06.000000000 -0700
+++ perl/t/Module_Pluggable/10innerpack_override.t 2008-03-14
03:46:20.000000000 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 3;
==== //depot/maint-5.8/perl/t/Module_Pluggable/10innerpack_super.t#1 (text) ====
Index: perl/t/Module_Pluggable/10innerpack_super.t
--- /dev/null 2008-03-12 08:50:16.603989457 -0700
+++ perl/t/Module_Pluggable/10innerpack_super.t 2008-03-14 03:46:20.000000000
-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;
==== //depot/maint-5.8/perl/t/Module_Pluggable/11usetwice.t#2 (text) ====
Index: perl/t/Module_Pluggable/11usetwice.t
--- perl/t/Module_Pluggable/11usetwice.t#1~31162~ 2007-05-07
04:15:06.000000000 -0700
+++ perl/t/Module_Pluggable/11usetwice.t 2008-03-14 03:46:20.000000000
-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;
==== //depot/maint-5.8/perl/t/Module_Pluggable/12only.t#2 (text) ====
Index: perl/t/Module_Pluggable/12only.t
--- perl/t/Module_Pluggable/12only.t#1~31162~ 2007-05-07 04:15:06.000000000
-0700
+++ perl/t/Module_Pluggable/12only.t 2008-03-14 03:46:20.000000000 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 10;
{
==== //depot/maint-5.8/perl/t/Module_Pluggable/12onlyarray.t#2 (text) ====
Index: perl/t/Module_Pluggable/12onlyarray.t
--- perl/t/Module_Pluggable/12onlyarray.t#1~31162~ 2007-05-07
04:15:06.000000000 -0700
+++ perl/t/Module_Pluggable/12onlyarray.t 2008-03-14 03:46:20.000000000
-0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 10;
{
==== //depot/maint-5.8/perl/t/Module_Pluggable/12onlyregex.t#2 (text) ====
Index: perl/t/Module_Pluggable/12onlyregex.t
--- perl/t/Module_Pluggable/12onlyregex.t#1~31162~ 2007-05-07
04:15:06.000000000 -0700
+++ perl/t/Module_Pluggable/12onlyregex.t 2008-03-14 03:46:20.000000000
-0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 10;
{
==== //depot/maint-5.8/perl/t/Module_Pluggable/13except.t#2 (text) ====
Index: perl/t/Module_Pluggable/13except.t
--- perl/t/Module_Pluggable/13except.t#1~31162~ 2007-05-07 04:15:06.000000000
-0700
+++ perl/t/Module_Pluggable/13except.t 2008-03-14 03:46:20.000000000 -0700
@@ -2,7 +2,7 @@
use strict;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
use Test::More tests => 10;
{
==== //depot/maint-5.8/perl/t/Module_Pluggable/13exceptarray.t#2 (text) ====
Index: perl/t/Module_Pluggable/13exceptarray.t
--- perl/t/Module_Pluggable/13exceptarray.t#1~31162~ 2007-05-07
04:15:06.000000000 -0700
+++ perl/t/Module_Pluggable/13exceptarray.t 2008-03-14 03:46:20.000000000
-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;
{
==== //depot/maint-5.8/perl/t/Module_Pluggable/13exceptregex.t#2 (text) ====
Index: perl/t/Module_Pluggable/13exceptregex.t
--- perl/t/Module_Pluggable/13exceptregex.t#1~31162~ 2007-05-07
04:15:06.000000000 -0700
+++ perl/t/Module_Pluggable/13exceptregex.t 2008-03-14 03:46:20.000000000
-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;
{
==== //depot/maint-5.8/perl/t/Module_Pluggable/14package.t#2 (text) ====
Index: perl/t/Module_Pluggable/14package.t
--- perl/t/Module_Pluggable/14package.t#1~31162~ 2007-05-07
04:15:06.000000000 -0700
+++ perl/t/Module_Pluggable/14package.t 2008-03-14 03:46:20.000000000 -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;
==== //depot/maint-5.8/perl/t/Module_Pluggable/15topicsafe.t#2 (text) ====
Index: perl/t/Module_Pluggable/15topicsafe.t
--- perl/t/Module_Pluggable/15topicsafe.t#1~31162~ 2007-05-07
04:15:06.000000000 -0700
+++ perl/t/Module_Pluggable/15topicsafe.t 2008-03-14 03:46:20.000000000
-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';
==== //depot/maint-5.8/perl/t/Module_Pluggable/16different_extension.t#2 (text)
====
Index: perl/t/Module_Pluggable/16different_extension.t
--- perl/t/Module_Pluggable/16different_extension.t#1~31162~ 2007-05-07
04:15:06.000000000 -0700
+++ perl/t/Module_Pluggable/16different_extension.t 2008-03-14
03:46:20.000000000 -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;
==== //depot/maint-5.8/perl/t/Module_Pluggable/17devel_inner_package.t#2 (text)
====
Index: perl/t/Module_Pluggable/17devel_inner_package.t
--- perl/t/Module_Pluggable/17devel_inner_package.t#1~31162~ 2007-05-07
04:15:06.000000000 -0700
+++ perl/t/Module_Pluggable/17devel_inner_package.t 2008-03-14
03:46:20.000000000 -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;
==== //depot/maint-5.8/perl/t/Module_Pluggable/18skipped_package.t#2 (text) ====
Index: perl/t/Module_Pluggable/18skipped_package.t
--- perl/t/Module_Pluggable/18skipped_package.t#1~31162~ 2007-05-07
04:15:06.000000000 -0700
+++ perl/t/Module_Pluggable/18skipped_package.t 2008-03-14 03:46:20.000000000
-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;
==== //depot/maint-5.8/perl/t/Module_Pluggable/19can_ok_clobber.t#2 (text) ====
Index: perl/t/Module_Pluggable/19can_ok_clobber.t
--- perl/t/Module_Pluggable/19can_ok_clobber.t#1~31162~ 2007-05-07
04:15:06.000000000 -0700
+++ perl/t/Module_Pluggable/19can_ok_clobber.t 2008-03-14 03:46:20.000000000
-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;
==== //depot/maint-5.8/perl/t/Module_Pluggable/20dodgy_files.t#2 (text) ====
Index: perl/t/Module_Pluggable/20dodgy_files.t
--- perl/t/Module_Pluggable/20dodgy_files.t#1~31162~ 2007-05-07
04:15:06.000000000 -0700
+++ perl/t/Module_Pluggable/20dodgy_files.t 2008-03-14 03:46:20.000000000
-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());
==== //depot/maint-5.8/perl/t/Module_Pluggable/21editor_junk.t#1 (text) ====
Index: perl/t/Module_Pluggable/21editor_junk.t
--- /dev/null 2008-03-12 08:50:16.603989457 -0700
+++ perl/t/Module_Pluggable/21editor_junk.t 2008-03-14 03:46:20.000000000
-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([EMAIL PROTECTED], [EMAIL PROTECTED], "is deeply");
+
+
+my $mpo = Module::Pluggable::Object->new(
+ package => 'EditorJunk',
+ filename => __FILE__,
+ include_editor_junk => 1,
+);
+
[EMAIL PROTECTED] = ('EditorJunk::Plugin::.#Bar', 'EditorJunk::Plugin::Bar',
'EditorJunk::Plugin::Foo');
[EMAIL PROTECTED] = sort $mpo->plugins();
+is_deeply([EMAIL PROTECTED], [EMAIL PROTECTED], "is deeply");
+
+
+
+package EditorJunk;
+
+use strict;
+use Module::Pluggable;
+
+
+sub new {
+ my $class = shift;
+ return bless {}, $class;
+
+}
+1;
+
+
==== //depot/maint-5.8/perl/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm#1
(text) ====
Index: perl/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm
--- /dev/null 2008-03-12 08:50:16.603989457 -0700
+++ perl/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm 2008-03-14
03:46:20.000000000 -0700
@@ -0,0 +1,9 @@
+package EditorJunk::Bar;
+
+
+use strict;
+
+
+1;
+
+
====
//depot/maint-5.8/perl/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm.swo#1
(text) ====
Index: perl/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm.swo
--- /dev/null 2008-03-12 08:50:16.603989457 -0700
+++ perl/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm.swo 2008-03-14
03:46:20.000000000 -0700
@@ -0,0 +1,9 @@
+package EditorJunk::Bar;
+
+
+use strict;
+
+
+1;
+
+
====
//depot/maint-5.8/perl/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm.swp#1
(text) ====
Index: perl/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm.swp
--- /dev/null 2008-03-12 08:50:16.603989457 -0700
+++ perl/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm.swp 2008-03-14
03:46:20.000000000 -0700
@@ -0,0 +1,9 @@
+package EditorJunk::Bar;
+
+
+use strict;
+
+
+1;
+
+
==== //depot/maint-5.8/perl/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm~#1
(text) ====
Index: perl/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm~
--- /dev/null 2008-03-12 08:50:16.603989457 -0700
+++ perl/t/Module_Pluggable/lib/EditorJunk/Plugin/Bar.pm~ 2008-03-14
03:46:20.000000000 -0700
@@ -0,0 +1,9 @@
+package EditorJunk::Bar;
+
+
+use strict;
+
+
+1;
+
+
==== //depot/maint-5.8/perl/t/Module_Pluggable/lib/EditorJunk/Plugin/Foo.pm#1
(text) ====
Index: perl/t/Module_Pluggable/lib/EditorJunk/Plugin/Foo.pm
--- /dev/null 2008-03-12 08:50:16.603989457 -0700
+++ perl/t/Module_Pluggable/lib/EditorJunk/Plugin/Foo.pm 2008-03-14
03:46:20.000000000 -0700
@@ -0,0 +1,9 @@
+package EditorJunk::Foo;
+
+
+use strict;
+
+
+1;
+
+
End of Patch.