r2490 - in packages: . libmodule-pluggable-perl
libmodule-pluggable-perl/branches
libmodule-pluggable-perl/branches/upstream
libmodule-pluggable-perl/branches/upstream/current
libmodule-pluggable-perl/branches/upstream/current/lib
libmodule-pluggable-perl/branches/upstream/current/lib/Module
libmodule-pluggable-perl/branches/upstream/current/t
libmodule-pluggable-perl/branches/upstream/current/t/acme
libmodule-pluggable-perl/branches/upstream/current/t/acme/Acme
libmodule-pluggable-perl/branches/upstream/current/t/acme/Acme/MyTest
libmodule-pluggable-perl/branches/upstream/current/t/acme/Acme/MyTest/Plugin
libmodule-pluggable-perl/branches/upstream/current/t/lib
libmodule-pluggable-perl/branches/upstream/current/t/lib/Acme
libmodule-pluggable-perl/branches/upstream/current/t/lib/Acme/MyTest
libmodule-pluggable-perl/branches/upstream/current/t/lib/Acme/MyTest/Plugin
libmodule-pluggable-perl/branches/upstream/current/t/lib/InnerTest
libmodule-pluggable-perl/branches/upstream/current/t/lib/InnerTest/Plugin
libmodule-pluggable-perl/branches/upstream/current/t/lib/MyOtherTest
libmodule-pluggable-perl/branches/upstream/current/t/lib/MyOtherTest/Plugin
libmodule-pluggable-perl/branches/upstream/current/t/lib/MyOtherTest/Plugin/Quux
libmodule-pluggable-perl/branches/upstream/current/t/lib/MyTest
libmodule-pluggable-perl/branches/upstream/current/t/lib/MyTest/Extend
libmodule-pluggable-perl/branches/upstream/current/t/lib/MyTest/Extend/Plugin
libmodule-pluggable-perl/branches/upstream/current/t/lib/MyTest/Plugin
libmodule-pluggable-perl/branches/upstream/current/t/lib/MyTest/Plugin/Quux
libmodule-pluggable-perl/branches/upstream/current/t/plugins
Niko Tyni
ntyni-guest at costa.debian.org
Fri Mar 31 18:01:10 UTC 2006
Author: ntyni-guest
Date: 2006-03-31 18:00:23 +0000 (Fri, 31 Mar 2006)
New Revision: 2490
Added:
packages/libmodule-pluggable-perl/
packages/libmodule-pluggable-perl/branches/
packages/libmodule-pluggable-perl/branches/upstream/
packages/libmodule-pluggable-perl/branches/upstream/current/
packages/libmodule-pluggable-perl/branches/upstream/current/Build.PL
packages/libmodule-pluggable-perl/branches/upstream/current/Changes
packages/libmodule-pluggable-perl/branches/upstream/current/INSTALL
packages/libmodule-pluggable-perl/branches/upstream/current/MANIFEST
packages/libmodule-pluggable-perl/branches/upstream/current/MANIFEST.SKIP
packages/libmodule-pluggable-perl/branches/upstream/current/META.yml
packages/libmodule-pluggable-perl/branches/upstream/current/Makefile.PL
packages/libmodule-pluggable-perl/branches/upstream/current/README
packages/libmodule-pluggable-perl/branches/upstream/current/lib/
packages/libmodule-pluggable-perl/branches/upstream/current/lib/Module/
packages/libmodule-pluggable-perl/branches/upstream/current/lib/Module/Pluggable.pm
packages/libmodule-pluggable-perl/branches/upstream/current/t/
packages/libmodule-pluggable-perl/branches/upstream/current/t/01use.t
packages/libmodule-pluggable-perl/branches/upstream/current/t/02alsoworks.t
packages/libmodule-pluggable-perl/branches/upstream/current/t/02works.t
packages/libmodule-pluggable-perl/branches/upstream/current/t/03diffname.t
packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmedir.t
packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmedir_single.t
packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmepath.t
packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmepath_single.t
packages/libmodule-pluggable-perl/branches/upstream/current/t/05postpath.t
packages/libmodule-pluggable-perl/branches/upstream/current/t/06multipath.t
packages/libmodule-pluggable-perl/branches/upstream/current/t/07instantiate.t
packages/libmodule-pluggable-perl/branches/upstream/current/t/08nothing.t
packages/libmodule-pluggable-perl/branches/upstream/current/t/09require.t
packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack.t
packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack_inner.t
packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack_noinner.t
packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack_override.t
packages/libmodule-pluggable-perl/branches/upstream/current/t/11usetwice.t
packages/libmodule-pluggable-perl/branches/upstream/current/t/12only.t
packages/libmodule-pluggable-perl/branches/upstream/current/t/12onlyarray.t
packages/libmodule-pluggable-perl/branches/upstream/current/t/12onlyregex.t
packages/libmodule-pluggable-perl/branches/upstream/current/t/13except.t
packages/libmodule-pluggable-perl/branches/upstream/current/t/13exceptarray.t
packages/libmodule-pluggable-perl/branches/upstream/current/t/13exceptregex.t
packages/libmodule-pluggable-perl/branches/upstream/current/t/14package.t
packages/libmodule-pluggable-perl/branches/upstream/current/t/acme/
packages/libmodule-pluggable-perl/branches/upstream/current/t/acme/Acme/
packages/libmodule-pluggable-perl/branches/upstream/current/t/acme/Acme/MyTest/
packages/libmodule-pluggable-perl/branches/upstream/current/t/acme/Acme/MyTest/Plugin/
packages/libmodule-pluggable-perl/branches/upstream/current/t/acme/Acme/MyTest/Plugin/Foo.pm
packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/
packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/Acme/
packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/Acme/MyTest/
packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/Acme/MyTest/Plugin/
packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/Acme/MyTest/Plugin/Foo.pm
packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/InnerTest/
packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/InnerTest/Plugin/
packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/InnerTest/Plugin/Foo.pm
packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyOtherTest/
packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyOtherTest/Plugin/
packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyOtherTest/Plugin/Bar.pm
packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyOtherTest/Plugin/Foo.pm
packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyOtherTest/Plugin/Quux.pm
packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyOtherTest/Plugin/Quux/
packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyOtherTest/Plugin/Quux/Foo.pm
packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyTest/
packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyTest/Extend/
packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyTest/Extend/Plugin/
packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyTest/Extend/Plugin/Bar.pm
packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyTest/Plugin/
packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyTest/Plugin/Bar.pm
packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyTest/Plugin/Foo.pm
packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyTest/Plugin/Quux/
packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyTest/Plugin/Quux/Foo.pm
packages/libmodule-pluggable-perl/branches/upstream/current/t/plugins/
packages/libmodule-pluggable-perl/branches/upstream/current/t/plugins/test.plugin
packages/libmodule-pluggable-perl/tags/
Log:
[svn-inject] Installing original source of libmodule-pluggable-perl
Added: packages/libmodule-pluggable-perl/branches/upstream/current/Build.PL
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/Build.PL 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/Build.PL 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,16 @@
+use strict;
+use Module::Build;
+
+my $build = Module::Build
+ ->new( module_name => "Module::Pluggable",
+ license => 'perl',
+ requires => {
+ 'Test::More' => 0,
+ 'File::Basename' => 0,
+ 'File::Spec::Functions' => 0,
+ },
+ create_makefile_pl => 'traditional',
+ );
+
+$build->create_build_script;
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/Changes
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/Changes 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/Changes 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,134 @@
+2005-02-02 - 2.6 Problems under tests
+
+ Richard Clamp diagnosed a problem as being due to the
+ fact that we exclude anything not from blib if there
+ was blib.pm is %INC. Of course if the module being
+ tested used another module that used Module::Pluggable
+ then the second module would fail.
+
+ Fixed it by checking to see if the caller had (^|/)blib/
+ in their filename.
+
+2004-12-20 - 2.5 'Inspiration' from Module::Pluggable::Fast
+
+ Noticed Sebastian Riedel's curious Module::Pluggable::Fast
+ which appears to break API backwards compatability in order
+ to inline an explicit call to 'new'. It has no tests.
+
+ A quick benchmark showed that it was about 10% faster
+ because of cruft that had accumulated over time. So
+ a few quick changes and now Module::Pluggable is only
+ 3% slower. Which is nice.
+
+ Also added a patch from Barbie to fix things under Windows.
+
+2004-12-15 - 2.4 Bug fix
+
+ There seemed to be some irregularities in how 5.8.1 worked
+ with the list_packages method. Fixed thanks to Schwern,
+ Michael Cummings and Jos Boumans.
+
+ Added some more documentation.
+
+ Added ability to specify except and only as regexes.
+
+2004-10-27 - 2.3 Niceties
+
+ Allow you to explicitly stop looking for inner packages.
+ Made it nicer to have single element search_dirs and search_paths.
+
+
+2004-10-08 - 2.2 Dieting
+
+ Thanks to suggestion and patches from Adam Kennedy
+ Module::Pluggable has dumped some weight and got rid of
+ the none Core dependecies of File::Find::Rule and
+ UNIVERSAL::require
+
+
+2004-08-25 - 2.1 Small buglette
+
+ Require inner packages when appropriate. This helps towards
+ making things work with PAR. Thanks to Brian Cassidy.
+
+ Never released.
+
+2004-08-19 - 2.0 Working inner packages
+
+ As long as you have require or instantiate set then we'll also find
+ inner packages. Why I didn't fix this way back in 1.3 I don't know.
+
+2004-07-18 - 1.9 Add 'package' option
+
+ This lets you install a method in another package's
+ namespace. Thanks to Simon Cozens.
+
+2004-07-08 - 1.8 Fix those two options
+
+ They worked before but now they're more robust.
+
+2004-07-07 - 1.7 Add support for limiting plugins
+
+ Added 'only' and ''except' options.
+
+2004-06-03 - 1.6 Add a traditional Makefile.PL
+
+ Even though I think Module::Build is much better.
+
+2004-05-25 - 1.5 Build.PL stupidity
+
+ Must add prereqs. Doh.
+
+2004-05-25 - 1.4 Multiple instances
+
+ Made it so you could use it twice in the same package.
+ Removed the inner package stuff inorder to fix it properly.
+
+2004-05-06 - 1.3 Ability to search in inner packages
+
+ Simon Cozens donated some code to allow us to search
+ inner packages.
+
+2004-05-06 - 1.2 Fix minor buglet
+
+ Apply a patch from Tom Insam to fix requiring without
+ instantiating and make require failures more verbose.
+
+2003-12-15 - 1.11 Update MANIFEST.
+
+ So that make dist works properly.
+
+2003-12-15 - 1.1 Make it work with multi level plugins
+
+ Apparently Foo::Plugin::Bar::Quux doesn't work.
+ Thanks to Darren Chamberlain for spotting this.
+
+2003-12-15 - 1.00 Add some more features
+
+ Added the ability to require without instantiating (for Tom Insam)
+ Prevented the names from being explicitly sorted (again, for Tom Insam)
+ Added in the ability to provide other search directorys.
+
+2003-11-27 - 0.95 Some Test::More issues
+
+ Explicitly number the tests which fixes some test more failures
+
+
+2003-10-21 - 0.9 We can rebuild you, we have the technology
+
+ Having used this in the wild some changes to make it better.
+
+
+2003-10-20 - 0.8 Fix.
+
+ Namespace issues.
+
+
+2003-10-17 - 0.7 And take your Build.PL with you
+
+ Pesky MANIFEST.SKIP
+
+
+2003-10-15 - 0.6 Initial release
+
+ Be free my pretty. EMANCIPIA!
Added: packages/libmodule-pluggable-perl/branches/upstream/current/INSTALL
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/INSTALL 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/INSTALL 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,12 @@
+
+Same as practically every other Perl module ...
+
+ % perl Build.PL
+ % perl Build
+ % perl Build test
+ % sudo Build install
+
+N.B : If you don't already have Module::Build then running Makefile.PL
+will prompt you to install it.
+
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/MANIFEST
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/MANIFEST 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/MANIFEST 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,48 @@
+Build.PL
+Changes
+INSTALL
+MANIFEST This list of files
+MANIFEST.SKIP
+META.yml
+Makefile.PL
+README
+lib/Module/Pluggable.pm
+t/01use.t
+t/02alsoworks.t
+t/02works.t
+t/03diffname.t
+t/04acmedir.t
+t/04acmedir_single.t
+t/04acmepath.t
+t/04acmepath_single.t
+t/05postpath.t
+t/06multipath.t
+t/07instantiate.t
+t/08nothing.t
+t/09require.t
+t/10innerpack.t
+t/10innerpack_inner.t
+t/10innerpack_noinner.t
+t/10innerpack_override.t
+t/11usetwice.t
+t/12only.t
+t/12onlyarray.t
+t/12onlyregex.t
+t/13except.t
+t/13exceptarray.t
+t/13exceptregex.t
+t/14package.t
+t/acme/Acme/MyTest/Plugin/Foo.pm
+t/lib/Acme/MyTest/Plugin/Foo.pm
+t/lib/MyTest/Extend/Plugin/Bar.pm
+t/lib/MyTest/Plugin/Bar.pm
+t/lib/MyTest/Plugin/Foo.pm
+t/lib/MyTest/Plugin/Quux/Foo.pm
+t/lib/MyOtherTest/Plugin/Bar.pm
+t/lib/MyOtherTest/Plugin/Foo.pm
+t/lib/MyOtherTest/Plugin/Quux.pm
+t/lib/MyOtherTest/Plugin/Quux/Foo.pm
+t/lib/InnerTest/Plugin/Foo.pm
+t/plugins/test.plugin
+
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/MANIFEST.SKIP
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/MANIFEST.SKIP 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/MANIFEST.SKIP 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,3 @@
+Build
+_build
+blib
Added: packages/libmodule-pluggable-perl/branches/upstream/current/META.yml
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/META.yml 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/META.yml 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,13 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
+name: Module-Pluggable
+version: 2.6
+version_from: lib/Module/Pluggable.pm
+installdirs: site
+requires:
+ File::Basename: 0
+ File::Spec::Functions: 0
+ Test::More: 0
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.25
Added: packages/libmodule-pluggable-perl/branches/upstream/current/Makefile.PL
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/Makefile.PL 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/Makefile.PL 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,15 @@
+# Note: this file was auto-generated by Module::Build::Compat version 0.03
+use ExtUtils::MakeMaker;
+WriteMakefile
+(
+ 'NAME' => 'Module::Pluggable',
+ 'VERSION_FROM' => 'lib/Module/Pluggable.pm',
+ 'PREREQ_PM' => {
+ 'File::Basename' => '0',
+ 'File::Spec::Functions' => '0',
+ 'Test::More' => '0'
+ },
+ 'INSTALLDIRS' => 'site',
+ 'PL_FILES' => {}
+ )
+;
Added: packages/libmodule-pluggable-perl/branches/upstream/current/README
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/README 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/README 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,109 @@
+NAME
+ Module::Pluggable - automatically give your module the ability to have
+ plugins
+
+SYNOPSIS
+ Simple use Module::Pluggable as a base -
+
+ package MyClass;
+ use Module::Pluggable;
+ use base qw(Module::Pluggable);
+
+ and then later ...
+
+ use MyClass;
+ my $mc = MyClass->new();
+ # returns the names of all plugins installed under MyClass::Plugins::*
+ my @plugins = $mc->plugins();
+
+ Alternatively, if you don't want to use 'plugins' as the method ...
+
+ package MyClass;
+ use Module::Pluggable (sub_name => 'foo');
+ use base qw(Module::Pluggable);
+
+ and then later ...
+
+ my @plugins = $mc->foo();
+
+ Or if you want to look in another directory
+
+ package MyClass;
+ use Module::Pluggable (search_path => ['Acme/MyClass/Plugin', 'MyClass/Extend']);
+ use base qw(Module::Pluggable);
+
+ Or if you want to instantiate each plugin rather than just return the
+ name
+
+ package MyClass;
+ use Module::Pluggable (instantiate => 'new');
+ use base qw(Module::Pluggable);
+
+ and then
+
+ # whatever is passed to 'plugins' will be passed
+ # to 'new' for each plugin
+ my @plugins = $mc->plugins(@options);
+
+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.
+
+OPTIONS
+ You can pass a hash of options when importing this module.
+
+ The options can be ...
+
+ sub_name
+ The name of the subroutine to create in your namespace.
+
+ By default this is 'plugins'
+
+ search_path
+ An array ref of paths to look in. Whilst attempts have been made provide
+ cross platform-ness when looking for plugins you'll have to take care of
+ the search paths yourself.
+
+ See the test files for examples on how to do this.
+
+ But something like this should work
+
+ use File::Spec::Functions qw(catdir);
+ # search in Some/Path/To/Plugins but in a cross platform way
+ use Module::Pluggable (search_path => [catdir(qw(Some Path To Plugins))]);
+
+ 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.
+
+FUTURE PLANS
+ This does everything I need and I can't really think fo any other
+ features I want to add. Finding multiple packages in one .pm file is
+ probably too hard and AFAICS it should 'just work'[tm] with PAR.
+
+ However suggestions (and patches) are welcome.
+
+AUTHOR
+ Simon Wistow <simon at thegestalt.org>
+
+COPYING
+ Copyright, 2003 Simon Wistow
+
+ Distributed under the same terms as Perl itself.
+
+BUGS
+ None known.
+
+SEE ALSO
+ File::Spec, File::Find::Rule, File::Basename, Class::Factory::Util
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/lib/Module/Pluggable.pm
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/lib/Module/Pluggable.pm 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/lib/Module/Pluggable.pm 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,407 @@
+package Module::Pluggable;
+
+use strict;
+use vars qw($VERSION);
+use Cwd ();
+use File::Find ();
+use File::Basename;
+use File::Spec::Functions qw(splitdir catdir abs2rel);
+use Carp qw(croak carp);
+
+
+# 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 = '2.6';
+
+=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 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.
+
+=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 <simon at thegestalt.org>
+
+=head1 COPYING
+
+Copyright, 2003 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
+
+
+sub import {
+ my $class = shift;
+ my %opts = @_;
+
+ # override 'require'
+ $opts{'require'} = 1 if $opts{'inner'};
+
+ my ($package, $filename) = caller;
+
+ # automatically turn a scalar search path or namespace into a arrayref
+ for (qw(search_path search_dirs)) {
+ $opts{$_} = [ $opts{$_} ] if exists $opts{$_} && !ref($opts{$_});
+ }
+
+
+ # the default name for the method is 'plugins'
+ my $sub = $opts{'sub_name'} || 'plugins';
+
+
+ # get our package
+ my ($pkg) = $opts{'package'} || $package;
+
+ my $subroutine = sub {
+ my $self = shift;
+
+
+ # default search path is '<Module>::<Name>::Plugin'
+ $opts{'search_path'} = ["${pkg}::Plugin"] unless $opts{'search_path'};
+
+ # predeclare
+ my @plugins;
+
+
+ # check to see if we're running under test
+ my @SEARCHDIR = exists $INC{"blib.pm"} && $filename =~ m!(^|/)blib/! ? grep {/blib/} @INC : @INC;
+
+ # add any search_dir params
+ unshift @SEARCHDIR, @{$opts{'search_dirs'}} if defined $opts{'search_dirs'};
+
+
+ # go through our @INC
+ foreach my $dir (@SEARCHDIR) {
+
+ # and each directory in our search path
+ foreach my $searchpath (@{$opts{'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
+
+
+ # 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 = ();
+ File::Find::find(
+ sub { # Inlined from File::Find::Rule C< name => '*.pm' >
+ return unless $File::Find::name =~ /\.pm$/;
+ (my $path = $File::Find::name) =~ s#^\\./##;
+ push @files, $path;
+ },
+ $sp );
+ chdir $cwd;
+
+ # foreach one we've found
+ foreach my $file (@files) {
+ next unless $file =~ m!\.pm$!;
+ # parse the file to get the name
+ my ($name, $directory) = fileparse($file, qr{\.pm});
+ $directory = abs2rel($directory, $sp);
+ # then create the class name in a cross platform way
+ $directory =~ s/^[a-z]://i if($^O =~ /MSWin32|dos/); # remove volume
+ my $plugin = join "::", splitdir catdir($searchpath, $directory, $name);
+ if (defined $opts{'instantiate'} || $opts{'require'}) {
+ eval "CORE::require $plugin";
+ carp "Couldn't require $plugin : $@" if $@;
+ }
+ 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 :(
+ unless (exists $opts{inner} && !$opts{inner}) {
+ for (list_packages($searchpath)) {
+ if (defined $opts{'instantiate'} || $opts{'require'}) {
+ eval "CORE::require $_";
+ # *No warnings here*
+ # next if $@;
+ }
+ push @plugins, $_;
+ } # for list packages
+ } # unless inner
+ } # foreach $searchpath
+ } # foreach $dir
+
+
+
+
+ # push @plugins, map { print STDERR "$_\n"; $_->require } list_packages($_) for (@{$opts{'search_path'}});
+
+ # return blank unless we've found anything
+ return () unless @plugins;
+
+
+ # exceptions
+ my %only;
+ my %except;
+ my $only;
+ my $except;
+
+ if (defined $opts{'only'}) {
+ if (ref($opts{'only'}) eq 'ARRAY') {
+ %only = map { $_ => 1 } @{$opts{'only'}};
+ } elsif (ref($opts{'only'}) eq 'Regexp') {
+ $only = $opts{'only'}
+ } elsif (ref($opts{'only'}) eq '') {
+ $only{$opts{'only'}} = 1;
+ }
+ }
+
+
+ if (defined $opts{'except'}) {
+ if (ref($opts{'except'}) eq 'ARRAY') {
+ %except = map { $_ => 1 } @{$opts{'except'}};
+ } elsif (ref($opts{'except'}) eq 'Regexp') {
+ $except = $opts{'except'}
+ } elsif (ref($opts{'except'}) eq '') {
+ $except{$opts{'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 $opts{'instantiate'}) {
+ my $method = $opts{'instantiate'};
+ return map { $_->$method(@_) } keys %plugins;
+ } else {
+ # no? just return the names
+ return keys %plugins;
+ }
+
+
+ };
+
+
+ no strict 'refs';
+ *{"$pkg\::$sub"} = $subroutine;
+}
+
+
+sub list_packages {
+ my $pack = shift; $pack .= "::" unless $pack =~ m!::$!;
+
+ no strict 'refs';
+ my @packs;
+ for (grep !/^main::$/, grep /::$/, keys %{$pack})
+ {
+ s!::$!!;
+ my @children = list_packages($pack.$_);
+ push @packs, "$pack$_" unless @children or /^::/;
+ push @packs, @children;
+ }
+ return @packs;
+}
+
+
+1;
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/01use.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/01use.t 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/01use.t 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,7 @@
+#!perl -w
+
+use strict;
+use Test::More tests => 1;
+
+use_ok('Module::Pluggable');
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/02alsoworks.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/02alsoworks.t 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/02alsoworks.t 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,41 @@
+#!perl -w
+
+use strict;
+use lib 't/lib';
+use Test::More tests => 5;
+
+my $foo;
+ok($foo = MyOtherTest->new());
+
+my @plugins;
+my @expected = qw(MyOtherTest::Plugin::Bar MyOtherTest::Plugin::Foo MyOtherTest::Plugin::Quux MyOtherTest::Plugin::Quux::Foo);
+ok(@plugins = sort $foo->plugins);
+
+
+
+is_deeply(\@plugins, \@expected, "is deeply");
+
+ at plugins = ();
+
+ok(@plugins = sort MyOtherTest->plugins);
+
+
+
+
+is_deeply(\@plugins, \@expected, "is deeply class");
+
+
+
+package MyOtherTest;
+
+use strict;
+use Module::Pluggable;
+
+
+sub new {
+ my $class = shift;
+ return bless {}, $class;
+
+}
+1;
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/02works.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/02works.t 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/02works.t 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,41 @@
+#!perl -w
+
+use strict;
+use lib 't/lib';
+use Test::More tests => 5;
+
+my $foo;
+ok($foo = MyTest->new());
+
+my @plugins;
+my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Foo MyTest::Plugin::Quux::Foo);
+ok(@plugins = sort $foo->plugins);
+
+
+
+is_deeply(\@plugins, \@expected, "is deeply");
+
+ at plugins = ();
+
+ok(@plugins = sort MyTest->plugins);
+
+
+
+
+is_deeply(\@plugins, \@expected, "is deeply class");
+
+
+
+package MyTest;
+
+use strict;
+use Module::Pluggable;
+
+
+sub new {
+ my $class = shift;
+ return bless {}, $class;
+
+}
+1;
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/03diffname.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/03diffname.t 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/03diffname.t 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,29 @@
+#!perl -w
+
+use strict;
+use lib 't/lib';
+use Test::More tests => 3;
+
+my $foo;
+ok($foo = MyTest->new());
+
+my @plugins;
+my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Foo MyTest::Plugin::Quux::Foo);
+ok(@plugins = sort $foo->foo);
+is_deeply(\@plugins, \@expected);
+
+
+
+package MyTest;
+
+use strict;
+use Module::Pluggable ( sub_name => 'foo');
+
+
+sub new {
+ my $class = shift;
+ return bless {}, $class;
+
+}
+1;
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmedir.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmedir.t 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmedir.t 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,29 @@
+#!perl -w
+
+use strict;
+use lib 't/lib';
+use Test::More tests => 3;
+
+
+my $foo;
+ok($foo = MyTest->new());
+
+my @plugins;
+my @expected = qw(Acme::MyTest::Plugin::Foo);
+ok(@plugins = sort $foo->plugins);
+is_deeply(\@plugins, \@expected);
+
+
+package MyTest;
+use File::Spec::Functions qw(catdir);
+use strict;
+use Module::Pluggable search_path => ["Acme::MyTest::Plugin"], search_dirs => [ "t/acme" ];
+
+
+sub new {
+ my $class = shift;
+ return bless {}, $class;
+
+}
+1;
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmedir_single.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmedir_single.t 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmedir_single.t 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,29 @@
+#!perl -w
+
+use strict;
+use lib 't/lib';
+use Test::More tests => 3;
+
+
+my $foo;
+ok($foo = MyTest->new());
+
+my @plugins;
+my @expected = qw(Acme::MyTest::Plugin::Foo);
+ok(@plugins = sort $foo->plugins);
+is_deeply(\@plugins, \@expected);
+
+
+package MyTest;
+use File::Spec::Functions qw(catdir);
+use strict;
+use Module::Pluggable search_path => "Acme::MyTest::Plugin", search_dirs => "t/acme" ;
+
+
+sub new {
+ my $class = shift;
+ return bless {}, $class;
+
+}
+1;
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmepath.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmepath.t 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmepath.t 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,29 @@
+#!perl -w
+
+use strict;
+use lib 't/lib';
+use Test::More tests => 3;
+
+
+my $foo;
+ok($foo = MyTest->new());
+
+my @plugins;
+my @expected = qw(Acme::MyTest::Plugin::Foo);
+ok(@plugins = sort $foo->plugins);
+is_deeply(\@plugins, \@expected);
+
+
+package MyTest;
+use File::Spec::Functions qw(catdir);
+use strict;
+use Module::Pluggable (search_path => ["Acme::MyTest::Plugin"]);
+
+
+sub new {
+ my $class = shift;
+ return bless {}, $class;
+
+}
+1;
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmepath_single.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmepath_single.t 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmepath_single.t 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,29 @@
+#!perl -w
+
+use strict;
+use lib 't/lib';
+use Test::More tests => 3;
+
+
+my $foo;
+ok($foo = MyTest->new());
+
+my @plugins;
+my @expected = qw(Acme::MyTest::Plugin::Foo);
+ok(@plugins = sort $foo->plugins);
+is_deeply(\@plugins, \@expected);
+
+
+package MyTest;
+use File::Spec::Functions qw(catdir);
+use strict;
+use Module::Pluggable search_path => "Acme::MyTest::Plugin";
+
+
+sub new {
+ my $class = shift;
+ return bless {}, $class;
+
+}
+1;
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/05postpath.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/05postpath.t 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/05postpath.t 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,30 @@
+#!perl -w
+
+use strict;
+use lib 't/lib';
+use Test::More tests => 3;
+
+
+my $foo;
+ok($foo = MyTest->new());
+
+my @plugins;
+my @expected = qw(MyTest::Extend::Plugin::Bar);
+ok(@plugins = sort $foo->plugins);
+is_deeply(\@plugins, \@expected);
+
+
+
+package MyTest;
+use File::Spec::Functions qw(catdir);
+use strict;
+use Module::Pluggable (search_path => ["MyTest::Extend::Plugin"]);
+
+
+sub new {
+ my $class = shift;
+ return bless {}, $class;
+
+}
+1;
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/06multipath.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/06multipath.t 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/06multipath.t 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,32 @@
+#!perl -w
+
+use strict;
+use lib 't/lib';
+use Test::More tests => 3;
+
+
+my $foo;
+ok($foo = MyTest->new());
+
+my @plugins;
+my @expected = qw(Acme::MyTest::Plugin::Foo MyTest::Extend::Plugin::Bar);
+ok(@plugins = sort $foo->plugins);
+
+is_deeply(\@plugins, \@expected);
+
+
+
+package MyTest;
+use File::Spec::Functions qw(catdir);
+use strict;
+use File::Spec::Functions qw(catdir);
+use Module::Pluggable (search_path => ["MyTest::Extend::Plugin", "Acme::MyTest::Plugin"]);
+
+
+sub new {
+ my $class = shift;
+ return bless {}, $class;
+
+}
+1;
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/07instantiate.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/07instantiate.t 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/07instantiate.t 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,33 @@
+#!perl -w
+
+use strict;
+use lib 't/lib';
+use Test::More tests => 4;
+
+my $foo;
+ok($foo = MyTest->new());
+
+
+
+my @plugins;
+ok(@plugins = sort $foo->booga(nork => 'fark'));
+is(ref $plugins[0],'MyTest::Extend::Plugin::Bar');
+is($plugins[0]->nork,'fark');
+
+
+
+
+package MyTest;
+use File::Spec::Functions qw(catdir);
+use strict;
+use lib 't/lib';
+use Module::Pluggable (search_path => ["MyTest::Extend::Plugin"], sub_name => 'booga', instantiate => 'new');
+
+
+sub new {
+ my $class = shift;
+ return bless {}, $class;
+
+}
+1;
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/08nothing.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/08nothing.t 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/08nothing.t 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,29 @@
+#!perl -w
+
+use strict;
+use lib 't/lib';
+use Test::More tests => 2;
+
+
+my $foo;
+ok($foo = MyTest->new());
+
+my @expected = ();
+my @plugins = sort $foo->plugins;
+is_deeply(\@plugins, \@expected);
+
+
+package MyTest;
+use File::Spec::Functions qw(catdir);
+use strict;
+use Module::Pluggable (search_path => ["No::Such::Modules"]);
+use base qw(Module::Pluggable);
+
+
+sub new {
+ my $class = shift;
+ return bless {}, $class;
+
+}
+1;
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/09require.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/09require.t 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/09require.t 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,28 @@
+#!perl -w
+
+use strict;
+use lib 't/lib';
+use Test::More tests => 2;
+
+my $t = MyTest->new();
+
+
+ok($t->plugins());
+
+ok(keys %{MyTest::Plugin::Foo::});
+
+
+package MyTest;
+use File::Spec::Functions qw(catdir);
+use strict;
+use Module::Pluggable (require => 1);
+use base qw(Module::Pluggable);
+
+
+sub new {
+ my $class = shift;
+ return bless {}, $class;
+
+}
+1;
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack.t 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack.t 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,33 @@
+#!perl -w
+
+use strict;
+use lib 't/lib';
+use Test::More tests => 3;
+
+
+
+my $t = InnerTest->new();
+
+my %plugins = map { $_ => 1 } $t->plugins;
+
+ok(keys %plugins, "Got some plugins");
+ok($plugins{'InnerTest::Plugin::Foo'}, "Got Foo");
+ok($plugins{'InnerTest::Plugin::Bar'}, "Got Bar - the inner package");
+
+
+
+package InnerTest;
+use strict;
+use Module::Pluggable require => 1;
+use base qw(Module::Pluggable);
+
+
+sub new {
+ my $class = shift;
+ return bless {}, $class;
+
+}
+
+
+1;
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack_inner.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack_inner.t 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack_inner.t 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,33 @@
+#!perl -w
+
+use strict;
+use lib 't/lib';
+use Test::More tests => 3;
+
+
+
+my $t = InnerTest->new();
+
+my %plugins = map { $_ => 1 } $t->plugins;
+
+ok(keys %plugins, "Got some plugins");
+ok($plugins{'InnerTest::Plugin::Foo'}, "Got Foo");
+ok($plugins{'InnerTest::Plugin::Bar'}, "Got Bar - the inner package");
+
+
+
+package InnerTest;
+use strict;
+use Module::Pluggable inner => 1;
+use base qw(Module::Pluggable);
+
+
+sub new {
+ my $class = shift;
+ return bless {}, $class;
+
+}
+
+
+1;
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack_noinner.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack_noinner.t 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack_noinner.t 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,33 @@
+#!perl -w
+
+use strict;
+use lib 't/lib';
+use Test::More tests => 3;
+
+
+
+my $t = InnerTest->new();
+
+my %plugins = map { $_ => 1 } $t->plugins;
+
+ok(keys %plugins, "Got some plugins");
+ok($plugins{'InnerTest::Plugin::Foo'}, "Got Foo");
+ok(!$plugins{'InnerTest::Plugin::Bar'}, "Didn't get Bar - the inner package");
+
+
+
+package InnerTest;
+use strict;
+use Module::Pluggable require => 1, inner => 0;
+use base qw(Module::Pluggable);
+
+
+sub new {
+ my $class = shift;
+ return bless {}, $class;
+
+}
+
+
+1;
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack_override.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack_override.t 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack_override.t 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,33 @@
+#!perl -w
+
+use strict;
+use lib 't/lib';
+use Test::More tests => 3;
+
+
+
+my $t = InnerTest->new();
+
+my %plugins = map { $_ => 1 } $t->plugins;
+
+ok(keys %plugins, "Got some plugins");
+ok($plugins{'InnerTest::Plugin::Foo'}, "Got Foo");
+ok($plugins{'InnerTest::Plugin::Bar'}, "Got Bar - the inner package");
+
+
+
+package InnerTest;
+use strict;
+use Module::Pluggable require => 0, inner => 1;
+use base qw(Module::Pluggable);
+
+
+sub new {
+ my $class = shift;
+ return bless {}, $class;
+
+}
+
+
+1;
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/11usetwice.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/11usetwice.t 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/11usetwice.t 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,43 @@
+#!perl -w
+
+use strict;
+use lib 't/lib';
+use Test::More tests => 3;
+
+my $foo;
+ok($foo = MyTest->new());
+
+my @plugins;
+my @expected = qw(MyTest::Extend::Plugin::Bar MyTest::Plugin::Bar MyTest::Plugin::Foo MyTest::Plugin::Quux::Foo);
+
+push @plugins, $foo->plugins;
+push @plugins, $foo->foo;
+
+ at plugins = sort @plugins;
+is_deeply(\@plugins, \@expected);
+
+ at plugins = ();
+
+push @plugins, MyTest->plugins;
+push @plugins, MyTest->foo;
+ at plugins = sort @plugins;
+is_deeply(\@plugins, \@expected);
+
+
+
+package MyTest;
+
+use strict;
+use Module::Pluggable;
+use Module::Pluggable ( search_path => [ "MyTest::Extend::Plugin" ] , sub_name => 'foo' );
+
+
+sub new {
+ my $class = shift;
+ return bless {}, $class;
+
+}
+
+
+1;
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/12only.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/12only.t 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/12only.t 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,34 @@
+#!perl -w
+
+use strict;
+use lib 't/lib';
+use Test::More tests => 5;
+
+my $foo;
+ok($foo = MyTest->new());
+
+my @plugins;
+my @expected = qw(MyTest::Plugin::Foo);
+ok(@plugins = sort $foo->plugins);
+is_deeply(\@plugins, \@expected);
+
+ at plugins = ();
+
+ok(@plugins = sort MyTest->plugins);
+is_deeply(\@plugins, \@expected);
+
+
+
+package MyTest;
+
+use strict;
+use Module::Pluggable only => "MyTest::Plugin::Foo";
+
+
+sub new {
+ my $class = shift;
+ return bless {}, $class;
+
+}
+1;
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/12onlyarray.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/12onlyarray.t 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/12onlyarray.t 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,34 @@
+#!perl -w
+
+use strict;
+use lib 't/lib';
+use Test::More tests => 5;
+
+my $foo;
+ok($foo = MyTest->new());
+
+my @plugins;
+my @expected = qw(MyTest::Plugin::Foo);
+ok(@plugins = sort $foo->plugins);
+is_deeply(\@plugins, \@expected);
+
+ at plugins = ();
+
+ok(@plugins = sort MyTest->plugins);
+is_deeply(\@plugins, \@expected);
+
+
+
+package MyTest;
+
+use strict;
+use Module::Pluggable only => [ "MyTest::Plugin::Foo" ];
+
+
+sub new {
+ my $class = shift;
+ return bless {}, $class;
+
+}
+1;
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/12onlyregex.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/12onlyregex.t 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/12onlyregex.t 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,34 @@
+#!perl -w
+
+use strict;
+use lib 't/lib';
+use Test::More tests => 5;
+
+my $foo;
+ok($foo = MyTest->new());
+
+my @plugins;
+my @expected = qw(MyTest::Plugin::Foo);
+ok(@plugins = sort $foo->plugins);
+is_deeply(\@plugins, \@expected);
+
+ at plugins = ();
+
+ok(@plugins = sort MyTest->plugins);
+is_deeply(\@plugins, \@expected);
+
+
+
+package MyTest;
+
+use strict;
+use Module::Pluggable only => qr/MyTest::Plugin::Foo$/;
+
+
+sub new {
+ my $class = shift;
+ return bless {}, $class;
+
+}
+1;
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/13except.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/13except.t 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/13except.t 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,36 @@
+#!perl -w
+
+use strict;
+use lib 't/lib';
+use Test::More tests => 5;
+
+my $foo;
+ok($foo = MyTest->new());
+
+my @plugins;
+my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Quux::Foo);
+ok(@plugins = sort $foo->plugins);
+
+is_deeply(\@plugins, \@expected);
+
+ at plugins = ();
+
+ok(@plugins = sort MyTest->plugins);
+is_deeply(\@plugins, \@expected);
+
+
+
+package MyTest;
+
+use strict;
+use Module::Pluggable except => "MyTest::Plugin::Foo";
+
+
+
+sub new {
+ my $class = shift;
+ return bless {}, $class;
+
+}
+1;
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/13exceptarray.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/13exceptarray.t 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/13exceptarray.t 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,36 @@
+#!perl -w
+
+use strict;
+use lib 't/lib';
+use Test::More tests => 5;
+
+my $foo;
+ok($foo = MyTest->new());
+
+my @plugins;
+my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Quux::Foo);
+ok(@plugins = sort $foo->plugins);
+
+is_deeply(\@plugins, \@expected);
+
+ at plugins = ();
+
+ok(@plugins = sort MyTest->plugins);
+is_deeply(\@plugins, \@expected);
+
+
+
+package MyTest;
+
+use strict;
+use Module::Pluggable except => [ "MyTest::Plugin::Foo" ];
+
+
+
+sub new {
+ my $class = shift;
+ return bless {}, $class;
+
+}
+1;
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/13exceptregex.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/13exceptregex.t 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/13exceptregex.t 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,36 @@
+#!perl -w
+
+use strict;
+use lib 't/lib';
+use Test::More tests => 5;
+
+my $foo;
+ok($foo = MyTest->new());
+
+my @plugins;
+my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Quux::Foo);
+ok(@plugins = sort $foo->plugins);
+
+is_deeply(\@plugins, \@expected);
+
+ at plugins = ();
+
+ok(@plugins = sort MyTest->plugins);
+is_deeply(\@plugins, \@expected);
+
+
+
+package MyTest;
+
+use strict;
+use Module::Pluggable except => qr/MyTest::Plugin::Foo/;
+
+
+
+sub new {
+ my $class = shift;
+ return bless {}, $class;
+
+}
+1;
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/14package.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/14package.t 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/14package.t 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,33 @@
+#!perl -w
+
+use strict;
+use lib 't/lib';
+use Test::More tests => 5;
+
+my $foo;
+ok($foo = MyTest->new());
+
+my @plugins;
+my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Foo MyTest::Plugin::Quux::Foo);
+ok(@plugins = sort $foo->plugins);
+is_deeply(\@plugins, \@expected);
+
+ at plugins = ();
+
+ok(@plugins = sort MyTest->plugins);
+is_deeply(\@plugins, \@expected);
+
+
+
+package MyTest;
+use strict;
+sub new { return bless {}, $_[0] }
+
+package MyOtherTest;
+use strict;
+use Module::Pluggable ( package => "MyTest" );
+sub new { return bless {}, $_[0] }
+
+
+1;
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/acme/Acme/MyTest/Plugin/Foo.pm
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/acme/Acme/MyTest/Plugin/Foo.pm 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/acme/Acme/MyTest/Plugin/Foo.pm 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,9 @@
+package Acme::MyTest::Plugin::Foo;
+
+
+use strict;
+
+
+1;
+
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/Acme/MyTest/Plugin/Foo.pm
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/Acme/MyTest/Plugin/Foo.pm 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/Acme/MyTest/Plugin/Foo.pm 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,9 @@
+package Acme::MyTest::Plugin::Foo;
+
+
+use strict;
+
+
+1;
+
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/InnerTest/Plugin/Foo.pm
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/InnerTest/Plugin/Foo.pm 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/InnerTest/Plugin/Foo.pm 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,7 @@
+package InnerTest::Plugin::Foo;
+use strict;
+
+package InnerTest::Plugin::Bar;
+use strict;
+
+1;
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyOtherTest/Plugin/Bar.pm
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyOtherTest/Plugin/Bar.pm 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyOtherTest/Plugin/Bar.pm 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,5 @@
+package MyOtherTest::Plugin::Bar;
+use strict;
+1;
+
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyOtherTest/Plugin/Foo.pm
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyOtherTest/Plugin/Foo.pm 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyOtherTest/Plugin/Foo.pm 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,5 @@
+package MyOtherTest::Plugin::Foo;
+use strict;
+1;
+
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyOtherTest/Plugin/Quux/Foo.pm
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyOtherTest/Plugin/Quux/Foo.pm 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyOtherTest/Plugin/Quux/Foo.pm 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,5 @@
+package MyOtherTest::Plugin::Quux::Foo;
+use strict;
+1;
+
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyOtherTest/Plugin/Quux.pm
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyOtherTest/Plugin/Quux.pm 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyOtherTest/Plugin/Quux.pm 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,5 @@
+package MyOtherTest::Plugin::Quux;
+use strict;
+1;
+
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyTest/Extend/Plugin/Bar.pm
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyTest/Extend/Plugin/Bar.pm 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyTest/Extend/Plugin/Bar.pm 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,17 @@
+package MyTest::Extend::Plugin::Bar;
+use strict;
+
+sub new {
+ my $class = shift;
+ my %self = @_;
+
+ return bless \%self, $class;
+}
+
+
+sub nork {
+ return $_[0]->{'nork'};
+}
+1;
+
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyTest/Plugin/Bar.pm
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyTest/Plugin/Bar.pm 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyTest/Plugin/Bar.pm 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,9 @@
+package MyTest::Plugin::Bar;
+
+
+use strict;
+
+
+1;
+
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyTest/Plugin/Foo.pm
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyTest/Plugin/Foo.pm 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyTest/Plugin/Foo.pm 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,9 @@
+package MyTest::Plugin::Foo;
+
+
+use strict;
+
+
+1;
+
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyTest/Plugin/Quux/Foo.pm
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyTest/Plugin/Quux/Foo.pm 2006-03-30 12:21:13 UTC (rev 2489)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/lib/MyTest/Plugin/Quux/Foo.pm 2006-03-31 18:00:23 UTC (rev 2490)
@@ -0,0 +1,9 @@
+package MyTest::Plugin::Quux::Foo;
+
+
+use strict;
+
+
+1;
+
+
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/plugins/test.plugin
===================================================================
(Binary files differ)
Property changes on: packages/libmodule-pluggable-perl/branches/upstream/current/t/plugins/test.plugin
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
More information about the Pkg-perl-cvs-commits
mailing list