r2494 - in
packages/libmodule-pluggable-perl/branches/upstream/current:
. lib/Module t
Niko Tyni
ntyni-guest at costa.debian.org
Fri Mar 31 18:02:21 UTC 2006
Author: ntyni-guest
Date: 2006-03-31 18:02:20 +0000 (Fri, 31 Mar 2006)
New Revision: 2494
Added:
packages/libmodule-pluggable-perl/branches/upstream/current/t/15topicsafe.t
Modified:
packages/libmodule-pluggable-perl/branches/upstream/current/Changes
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/lib/Module/Pluggable.pm
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
Log:
Load /tmp/tmp.jFu14C/libmodule-pluggable-perl-2.97 into
packages/libmodule-pluggable-perl/branches/upstream/current.
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/Changes
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/Changes 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/Changes 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,3 +1,34 @@
+2006-02-06 - 2.97
+ Patch from Ricardo Signes to fix bug where File::Find
+ is not topic-safe in 5.6.1
+
+2005-09-01 - 2.96
+ Patch from Alex Vandiver to sort an edge case where the package
+ stash to contain "::"
+
+2005-07-30 - 2.95
+ Patch from Alex Vandiver to sort ::ISA::CACHE issues.
+ More patches from Christopher H. Laco to sort out only and except
+ and to fix calling search_path( add => ... ) before plugins()
+
+2005-07-09 - 2.9 More Tainting fixes
+ Patches from Christopher H. Laco and Joe McMahon to do more taint fixing
+ Suggestion from Christopher H. Laco to do a can check before instatiating
+
+2005-03-18 - 2.8 Minor fixes
+
+ Patch from Marcus Thiesen to fix so ISA cache magic
+ Patch from Anthony D. Urso to get M::P to work under taint
+
+
+2005-02-14 - 2.7 Allow redefinition of search_path
+
+ A patch from Barbie to allow you to do
+
+ $self->search_path( add => 'Some::Path' );
+ $self->search_path( new => 'Some::New::Path' );
+
+
2005-02-02 - 2.6 Problems under tests
Richard Clamp diagnosed a problem as being due to the
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/MANIFEST
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/MANIFEST 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/MANIFEST 2006-03-31 18:02:20 UTC (rev 2494)
@@ -32,6 +32,7 @@
t/13exceptarray.t
t/13exceptregex.t
t/14package.t
+t/15topicsafe.t
t/acme/Acme/MyTest/Plugin/Foo.pm
t/lib/Acme/MyTest/Plugin/Foo.pm
t/lib/MyTest/Extend/Plugin/Bar.pm
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/MANIFEST.SKIP
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/MANIFEST.SKIP 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/MANIFEST.SKIP 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,3 +1,6 @@
Build
_build
blib
+Makefile
+\.tar\.gz$
+\.svn
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/META.yml
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/META.yml 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/META.yml 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,13 +1,16 @@
-# 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
+---
+name: Module-Pluggable
+version: 2.97
+author:
+ - Simon Wistow <simon at thegestalt.org>
+abstract: automatically give your module the ability to have plugins
+license: perl
requires:
- File::Basename: 0
- File::Spec::Functions: 0
- Test::More: 0
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.25
+ File::Basename: 0
+ File::Spec::Functions: 0
+ Test::More: 0
+provides:
+ Module::Pluggable:
+ file: lib/Module/Pluggable.pm
+ version: 2.97
+generated_by: Module::Build version 0.2611
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/lib/Module/Pluggable.pm
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/lib/Module/Pluggable.pm 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/lib/Module/Pluggable.pm 2006-03-31 18:02:20 UTC (rev 2494)
@@ -2,7 +2,6 @@
use strict;
use vars qw($VERSION);
-use Cwd ();
use File::Find ();
use File::Basename;
use File::Spec::Functions qw(splitdir catdir abs2rel);
@@ -14,7 +13,7 @@
# Peter Gibbons: I wouldn't say I've been missing it, Bob!
-$VERSION = '2.6';
+$VERSION = '2.97';
=pod
@@ -38,6 +37,52 @@
# 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
@@ -189,6 +234,19 @@
passing a C<package> option allows you to place the plugin method in a
different package other than your own.
+=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
@@ -228,6 +286,10 @@
# override 'require'
$opts{'require'} = 1 if $opts{'inner'};
+ if ($opts{'par'}) {
+
+ }
+
my ($package, $filename) = caller;
# automatically turn a scalar search path or namespace into a arrayref
@@ -274,27 +336,38 @@
# find all the .pm files in it
# this isn't perfect and won't find multiple plugins per file
- my $cwd = Cwd::getcwd;
+ #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;
+ { # 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 =~ /\.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$!;
+ # untaint the file; accept .pm only
+ next unless ($file) = ($file =~ /(.*\.pm)$/);
# parse the file to get the name
- my ($name, $directory) = fileparse($file, qr{\.pm});
+ 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
+ if ($directory) {
+ ($directory) = ($directory =~ /(.*)/);
+ }
+ else {
+ $directory = "";
+ }
my $plugin = join "::", splitdir catdir($searchpath, $directory, $name);
if (defined $opts{'instantiate'} || $opts{'require'}) {
+
eval "CORE::require $plugin";
carp "Couldn't require $plugin : $@" if $@;
}
@@ -373,7 +446,7 @@
# are we instantiating or requring?
if (defined $opts{'instantiate'}) {
my $method = $opts{'instantiate'};
- return map { $_->$method(@_) } keys %plugins;
+ return map { ($_->can($method)) ? $_->$method(@_) : () } keys %plugins;
} else {
# no? just return the names
return keys %plugins;
@@ -383,8 +456,42 @@
};
+ my $searchsub = sub {
+ my $self = shift;
+ my ($action, at paths) = @_;
+
+ $opts{'search_path'} = ["${pkg}::Plugin"] if ($action eq 'add' and not $opts{'search_path'} );;
+ push @{$opts{'search_path'}}, @paths if ($action eq 'add');
+ $opts{'search_path'} = \@paths if ($action eq 'new');
+ return $opts{'search_path'};
+ };
+
+ my $onlysub = sub {
+ my ($self, $only) = @_;
+
+ if (defined $only) {
+ $opts{'only'} = $only;
+ };
+
+ return $opts{'only'};
+ };
+
+ my $exceptsub = sub {
+ my ($self, $except) = @_;
+
+ if (defined $except) {
+ $opts{'except'} = $except;
+ };
+
+ return $opts{'except'};
+ };
+
no strict 'refs';
+ no warnings 'redefine';
*{"$pkg\::$sub"} = $subroutine;
+ *{"$pkg\::search_path"} = $searchsub;
+ *{"$pkg\::only"} = $onlysub;
+ *{"$pkg\::except"} = $exceptsub;
}
@@ -393,14 +500,14 @@
no strict 'refs';
my @packs;
- for (grep !/^main::$/, grep /::$/, keys %{$pack})
+ for (grep !/^(main|)::$/, grep /::$/, keys %{$pack})
{
s!::$!!;
my @children = list_packages($pack.$_);
- push @packs, "$pack$_" unless @children or /^::/;
+ push @packs, "$pack$_" unless @children or /^::/;
push @packs, @children;
}
- return @packs;
+ return grep {$_ !~ /::::ISA::CACHE/} @packs;
}
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/t/01use.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/01use.t 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/01use.t 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,4 +1,4 @@
-#!perl -w
+#!perl -wT
use strict;
use Test::More tests => 1;
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/t/02alsoworks.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/02alsoworks.t 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/02alsoworks.t 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,4 +1,4 @@
-#!perl -w
+#!perl -wT
use strict;
use lib 't/lib';
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/t/02works.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/02works.t 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/02works.t 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,4 +1,4 @@
-#!perl -w
+#!perl -wT
use strict;
use lib 't/lib';
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/t/03diffname.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/03diffname.t 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/03diffname.t 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,4 +1,4 @@
-#!perl -w
+#!perl -wT
use strict;
use lib 't/lib';
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmedir.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmedir.t 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmedir.t 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,4 +1,4 @@
-#!perl -w
+#!perl -wT
use strict;
use lib 't/lib';
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmedir_single.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmedir_single.t 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmedir_single.t 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,4 +1,4 @@
-#!perl -w
+#!perl -wT
use strict;
use lib 't/lib';
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmepath.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmepath.t 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmepath.t 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,4 +1,4 @@
-#!perl -w
+#!perl -wT
use strict;
use lib 't/lib';
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmepath_single.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmepath_single.t 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/04acmepath_single.t 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,4 +1,4 @@
-#!perl -w
+#!perl -wT
use strict;
use lib 't/lib';
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/t/05postpath.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/05postpath.t 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/05postpath.t 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,4 +1,4 @@
-#!perl -w
+#!perl -wT
use strict;
use lib 't/lib';
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/t/06multipath.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/06multipath.t 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/06multipath.t 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,4 +1,4 @@
-#!perl -w
+#!perl -wT
use strict;
use lib 't/lib';
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/t/07instantiate.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/07instantiate.t 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/07instantiate.t 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,8 +1,8 @@
-#!perl -w
+#!perl -wT
use strict;
use lib 't/lib';
-use Test::More tests => 4;
+use Test::More tests => 6;
my $foo;
ok($foo = MyTest->new());
@@ -15,6 +15,10 @@
is($plugins[0]->nork,'fark');
+ at plugins = ();
+eval { @plugins = $foo->wooga( nork => 'fark') };
+is($@, '');
+is(scalar(@plugins),0);
package MyTest;
@@ -22,6 +26,7 @@
use strict;
use lib 't/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');
sub new {
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/t/08nothing.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/08nothing.t 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/08nothing.t 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,4 +1,4 @@
-#!perl -w
+#!perl -wT
use strict;
use lib 't/lib';
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/t/09require.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/09require.t 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/09require.t 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,4 +1,4 @@
-#!perl -w
+#!perl-wT
use strict;
use lib 't/lib';
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack.t 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack.t 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,4 +1,4 @@
-#!perl -w
+#!perl-wT
use strict;
use lib 't/lib';
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack_inner.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack_inner.t 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack_inner.t 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,4 +1,4 @@
-#!perl -w
+#!perl-wT
use strict;
use lib 't/lib';
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack_noinner.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack_noinner.t 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack_noinner.t 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,4 +1,4 @@
-#!perl -w
+#!perl-wT
use strict;
use lib 't/lib';
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack_override.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack_override.t 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/10innerpack_override.t 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,4 +1,4 @@
-#!perl -w
+#!perl-wT
use strict;
use lib 't/lib';
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/t/11usetwice.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/11usetwice.t 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/11usetwice.t 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,4 +1,4 @@
-#!perl -w
+#!perl-wT
use strict;
use lib 't/lib';
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/t/12only.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/12only.t 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/12only.t 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,24 +1,39 @@
-#!perl -w
+#!perl-wT
use strict;
use lib 't/lib';
-use Test::More tests => 5;
+use Test::More tests => 10;
-my $foo;
-ok($foo = MyTest->new());
+{
+ my $foo;
+ ok($foo = MyTest->new());
-my @plugins;
-my @expected = qw(MyTest::Plugin::Foo);
-ok(@plugins = sort $foo->plugins);
-is_deeply(\@plugins, \@expected);
+ my @plugins;
+ my @expected = qw(MyTest::Plugin::Foo);
+ ok(@plugins = sort $foo->plugins);
+ is_deeply(\@plugins, \@expected);
- at plugins = ();
+ @plugins = ();
-ok(@plugins = sort MyTest->plugins);
-is_deeply(\@plugins, \@expected);
+ ok(@plugins = sort MyTest->plugins);
+ is_deeply(\@plugins, \@expected);
+}
+{
+ my $foo;
+ ok($foo = MyTestSub->new());
+ my @plugins;
+ my @expected = qw(MyTest::Plugin::Foo);
+ ok(@plugins = sort $foo->plugins);
+ is_deeply(\@plugins, \@expected);
+ @plugins = ();
+
+ ok(@plugins = sort MyTestSub->plugins);
+ is_deeply(\@plugins, \@expected);
+}
+
package MyTest;
use strict;
@@ -30,5 +45,19 @@
return bless {}, $class;
}
-1;
+package MyTestSub;
+
+use strict;
+use Module::Pluggable search_path => "MyTest::Plugin";
+
+
+sub new {
+ my $class = shift;
+ my $self = bless {}, $class;
+
+ $self->only("MyTest::Plugin::Foo");
+
+ return $self;
+}
+1;
\ No newline at end of file
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/t/12onlyarray.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/12onlyarray.t 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/12onlyarray.t 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,24 +1,39 @@
-#!perl -w
+#!perl-wT
use strict;
use lib 't/lib';
-use Test::More tests => 5;
+use Test::More tests => 10;
-my $foo;
-ok($foo = MyTest->new());
+{
+ my $foo;
+ ok($foo = MyTest->new());
-my @plugins;
-my @expected = qw(MyTest::Plugin::Foo);
-ok(@plugins = sort $foo->plugins);
-is_deeply(\@plugins, \@expected);
+ my @plugins;
+ my @expected = qw(MyTest::Plugin::Foo);
+ ok(@plugins = sort $foo->plugins);
+ is_deeply(\@plugins, \@expected);
- at plugins = ();
+ @plugins = ();
-ok(@plugins = sort MyTest->plugins);
-is_deeply(\@plugins, \@expected);
+ ok(@plugins = sort MyTest->plugins);
+ is_deeply(\@plugins, \@expected);
+}
+{
+ my $foo;
+ ok($foo = MyTestSub->new());
+ my @plugins;
+ my @expected = qw(MyTest::Plugin::Foo);
+ ok(@plugins = sort $foo->plugins);
+ is_deeply(\@plugins, \@expected);
+ @plugins = ();
+
+ ok(@plugins = sort MyTestSub->plugins);
+ is_deeply(\@plugins, \@expected);
+}
+
package MyTest;
use strict;
@@ -30,5 +45,20 @@
return bless {}, $class;
}
+
+package MyTestSub;
+
+use strict;
+use Module::Pluggable search_path => "MyTest::Plugin";
+
+
+sub new {
+ my $class = shift;
+ my $self = bless {}, $class;
+
+ $self->only(["MyTest::Plugin::Foo"]);
+
+ return $self;
+}
1;
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/t/12onlyregex.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/12onlyregex.t 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/12onlyregex.t 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,24 +1,39 @@
-#!perl -w
+#!perl-wT
use strict;
use lib 't/lib';
-use Test::More tests => 5;
+use Test::More tests => 10;
-my $foo;
-ok($foo = MyTest->new());
+{
+ my $foo;
+ ok($foo = MyTest->new());
-my @plugins;
-my @expected = qw(MyTest::Plugin::Foo);
-ok(@plugins = sort $foo->plugins);
-is_deeply(\@plugins, \@expected);
+ my @plugins;
+ my @expected = qw(MyTest::Plugin::Foo);
+ ok(@plugins = sort $foo->plugins);
+ is_deeply(\@plugins, \@expected);
- at plugins = ();
+ @plugins = ();
-ok(@plugins = sort MyTest->plugins);
-is_deeply(\@plugins, \@expected);
+ ok(@plugins = sort MyTest->plugins);
+ is_deeply(\@plugins, \@expected);
+}
+{
+ my $foo;
+ ok($foo = MyTestSub->new());
+ my @plugins;
+ my @expected = qw(MyTest::Plugin::Foo);
+ ok(@plugins = sort $foo->plugins);
+ is_deeply(\@plugins, \@expected);
+ @plugins = ();
+
+ ok(@plugins = sort MyTestSub->plugins);
+ is_deeply(\@plugins, \@expected);
+}
+
package MyTest;
use strict;
@@ -30,5 +45,20 @@
return bless {}, $class;
}
+
+package MyTestSub;
+
+use strict;
+use Module::Pluggable search_path => "MyTest::Plugin";
+
+
+sub new {
+ my $class = shift;
+ my $self = bless {}, $class;
+
+ $self->only(qr/MyTest::Plugin::Foo$/);
+
+ return $self;
+}
1;
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/t/13except.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/13except.t 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/13except.t 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,25 +1,41 @@
-#!perl -w
+#!perl-wT
use strict;
use lib 't/lib';
-use Test::More tests => 5;
+use Test::More tests => 10;
-my $foo;
-ok($foo = MyTest->new());
+{
+ my $foo;
+ ok($foo = MyTest->new());
-my @plugins;
-my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Quux::Foo);
-ok(@plugins = sort $foo->plugins);
+ my @plugins;
+ my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Quux::Foo);
+ ok(@plugins = sort $foo->plugins);
-is_deeply(\@plugins, \@expected);
+ is_deeply(\@plugins, \@expected);
- at plugins = ();
+ @plugins = ();
-ok(@plugins = sort MyTest->plugins);
-is_deeply(\@plugins, \@expected);
+ ok(@plugins = sort MyTest->plugins);
+ is_deeply(\@plugins, \@expected);
+}
+{
+ my $foo;
+ ok($foo = MyTestSub->new());
+ my @plugins;
+ my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Quux::Foo);
+ ok(@plugins = sort $foo->plugins);
+ is_deeply(\@plugins, \@expected);
+
+ @plugins = ();
+
+ ok(@plugins = sort MyTestSub->plugins);
+ is_deeply(\@plugins, \@expected);
+}
+
package MyTest;
use strict;
@@ -32,5 +48,20 @@
return bless {}, $class;
}
+
+package MyTestSub;
+
+use strict;
+use Module::Pluggable search_path => "MyTest::Plugin";
+
+
+sub new {
+ my $class = shift;
+ my $self = bless {}, $class;
+
+ $self->except("MyTest::Plugin::Foo");
+
+ return $self;
+}
1;
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/t/13exceptarray.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/13exceptarray.t 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/13exceptarray.t 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,25 +1,41 @@
-#!perl -w
+#!perl-wT
use strict;
use lib 't/lib';
-use Test::More tests => 5;
+use Test::More tests => 10;
-my $foo;
-ok($foo = MyTest->new());
+{
+ my $foo;
+ ok($foo = MyTest->new());
-my @plugins;
-my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Quux::Foo);
-ok(@plugins = sort $foo->plugins);
+ my @plugins;
+ my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Quux::Foo);
+ ok(@plugins = sort $foo->plugins);
-is_deeply(\@plugins, \@expected);
+ is_deeply(\@plugins, \@expected);
- at plugins = ();
+ @plugins = ();
-ok(@plugins = sort MyTest->plugins);
-is_deeply(\@plugins, \@expected);
+ ok(@plugins = sort MyTest->plugins);
+ is_deeply(\@plugins, \@expected);
+}
+{
+ my $foo;
+ ok($foo = MyTestSub->new());
+ my @plugins;
+ my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Quux::Foo);
+ ok(@plugins = sort $foo->plugins);
+ is_deeply(\@plugins, \@expected);
+
+ @plugins = ();
+
+ ok(@plugins = sort MyTestSub->plugins);
+ is_deeply(\@plugins, \@expected);
+}
+
package MyTest;
use strict;
@@ -32,5 +48,20 @@
return bless {}, $class;
}
+
+package MyTestSub;
+
+use strict;
+use Module::Pluggable search_path => "MyTest::Plugin";
+
+
+sub new {
+ my $class = shift;
+ my $self = bless {}, $class;
+
+ $self->except(["MyTest::Plugin::Foo"]);
+
+ return $self;
+}
1;
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/t/13exceptregex.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/13exceptregex.t 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/13exceptregex.t 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,25 +1,41 @@
-#!perl -w
+#!perl-wT
use strict;
use lib 't/lib';
-use Test::More tests => 5;
+use Test::More tests => 10;
-my $foo;
-ok($foo = MyTest->new());
+{
+ my $foo;
+ ok($foo = MyTest->new());
-my @plugins;
-my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Quux::Foo);
-ok(@plugins = sort $foo->plugins);
+ my @plugins;
+ my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Quux::Foo);
+ ok(@plugins = sort $foo->plugins);
-is_deeply(\@plugins, \@expected);
+ is_deeply(\@plugins, \@expected);
- at plugins = ();
+ @plugins = ();
-ok(@plugins = sort MyTest->plugins);
-is_deeply(\@plugins, \@expected);
+ ok(@plugins = sort MyTest->plugins);
+ is_deeply(\@plugins, \@expected);
+}
+{
+ my $foo;
+ ok($foo = MyTestSub->new());
+ my @plugins;
+ my @expected = qw(MyTest::Plugin::Bar MyTest::Plugin::Quux::Foo);
+ ok(@plugins = sort $foo->plugins);
+ is_deeply(\@plugins, \@expected);
+
+ @plugins = ();
+
+ ok(@plugins = sort MyTestSub->plugins);
+ is_deeply(\@plugins, \@expected);
+}
+
package MyTest;
use strict;
@@ -32,5 +48,20 @@
return bless {}, $class;
}
+
+package MyTestSub;
+
+use strict;
+use Module::Pluggable search_path => "MyTest::Plugin";
+
+
+sub new {
+ my $class = shift;
+ my $self = bless {}, $class;
+
+ $self->except(qr/MyTest::Plugin::Foo/);
+
+ return $self;
+}
1;
Modified: packages/libmodule-pluggable-perl/branches/upstream/current/t/14package.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/14package.t 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/14package.t 2006-03-31 18:02:20 UTC (rev 2494)
@@ -1,4 +1,4 @@
-#!perl -w
+#!perl-wT
use strict;
use lib 't/lib';
Added: packages/libmodule-pluggable-perl/branches/upstream/current/t/15topicsafe.t
===================================================================
--- packages/libmodule-pluggable-perl/branches/upstream/current/t/15topicsafe.t 2006-03-31 18:00:43 UTC (rev 2493)
+++ packages/libmodule-pluggable-perl/branches/upstream/current/t/15topicsafe.t 2006-03-31 18:02:20 UTC (rev 2494)
@@ -0,0 +1,15 @@
+#!perl-wT
+
+use strict;
+use lib 't/lib';
+use Test::More 'no_plan';
+
+use Module::Pluggable search_path => 'Acme::MyTest';
+
+my $topic = "topic";
+
+for ($topic) {
+ main->plugins;
+}
+
+is($topic, 'topic', "we've got the right topic");
More information about the Pkg-perl-cvs-commits
mailing list