r33281 - in /branches/upstream/libmodule-pluggable-perl/current: Changes MANIFEST META.yml Makefile.PL lib/Module/Pluggable.pm lib/Module/Pluggable/Object.pm t/10innerpack_onefile.t t/12onlyrequire.t t/lib/Acme/Foo-Bar.pm t/lib/Zot/ t/lib/Zot/.Zork.pm
bricas-guest at users.alioth.debian.org
bricas-guest at users.alioth.debian.org
Wed Apr 15 17:58:57 UTC 2009
Author: bricas-guest
Date: Wed Apr 15 17:58:52 2009
New Revision: 33281
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=33281
Log:
[svn-upgrade] Integrating new upstream version, libmodule-pluggable-perl (3.9)
Added:
branches/upstream/libmodule-pluggable-perl/current/t/10innerpack_onefile.t
branches/upstream/libmodule-pluggable-perl/current/t/12onlyrequire.t
branches/upstream/libmodule-pluggable-perl/current/t/lib/Acme/Foo-Bar.pm
branches/upstream/libmodule-pluggable-perl/current/t/lib/Zot/
branches/upstream/libmodule-pluggable-perl/current/t/lib/Zot/.Zork.pm
Modified:
branches/upstream/libmodule-pluggable-perl/current/Changes
branches/upstream/libmodule-pluggable-perl/current/MANIFEST
branches/upstream/libmodule-pluggable-perl/current/META.yml
branches/upstream/libmodule-pluggable-perl/current/Makefile.PL
branches/upstream/libmodule-pluggable-perl/current/lib/Module/Pluggable.pm
branches/upstream/libmodule-pluggable-perl/current/lib/Module/Pluggable/Object.pm
Modified: branches/upstream/libmodule-pluggable-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmodule-pluggable-perl/current/Changes?rev=33281&op=diff
==============================================================================
--- branches/upstream/libmodule-pluggable-perl/current/Changes (original)
+++ branches/upstream/libmodule-pluggable-perl/current/Changes Wed Apr 15 17:58:52 2009
@@ -1,3 +1,7 @@
+2009-03-02 - 3.9
+ Allow inner packages when in a one file situation (suggestion from Christopher Brown)
+ Fix bug with requiring skipped packages (from Jos Boumans)
+
2008-03-16 - 3.8
Set INSTALLDIRS correctly in Makefile.PL
A couple of other fixups to play nicely in Core
Modified: branches/upstream/libmodule-pluggable-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmodule-pluggable-perl/current/MANIFEST?rev=33281&op=diff
==============================================================================
--- branches/upstream/libmodule-pluggable-perl/current/MANIFEST (original)
+++ branches/upstream/libmodule-pluggable-perl/current/MANIFEST Wed Apr 15 17:58:52 2009
@@ -25,12 +25,14 @@
t/10innerpack.t
t/10innerpack_inner.t
t/10innerpack_noinner.t
+t/10innerpack_onefile.t
t/10innerpack_override.t
t/10innerpack_super.t
t/11usetwice.t
t/12only.t
t/12onlyarray.t
t/12onlyregex.t
+t/12onlyrequire.t
t/13except.t
t/13exceptarray.t
t/13exceptregex.t
@@ -43,6 +45,7 @@
t/20dodgy_files.t
t/21editor_junk.t
t/acme/Acme/MyTest/Plugin/Foo.pm
+t/lib/Acme/Foo-Bar.pm
t/lib/Acme/MyTest/Plugin/Foo.pm
t/lib/EditorJunk/Plugin/Bar.pm
t/lib/EditorJunk/Plugin/Bar.pm.swo
@@ -64,3 +67,4 @@
t/lib/No/Middle.pm
t/lib/OddTest/Plugin/Foo.pm
t/lib/TA/C/A/I.pm
+t/lib/Zot/.Zork.pm
Modified: branches/upstream/libmodule-pluggable-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmodule-pluggable-perl/current/META.yml?rev=33281&op=diff
==============================================================================
--- branches/upstream/libmodule-pluggable-perl/current/META.yml (original)
+++ branches/upstream/libmodule-pluggable-perl/current/META.yml Wed Apr 15 17:58:52 2009
@@ -1,15 +1,21 @@
--- #YAML:1.0
-name: Module-Pluggable
-version: 3.8
-abstract: ~
-license: ~
-author: ~
-generated_by: ExtUtils::MakeMaker version 6.38
-distribution_type: module
-requires:
- File::Basename: 0
- File::Spec: 3.00
- Test::More: 0.62
+name: Module-Pluggable
+version: 3.9
+abstract: ~
+author: []
+license: unknown
+distribution_type: module
+configure_requires:
+ ExtUtils::MakeMaker: 0
+requires:
+ File::Basename: 0
+ File::Spec: 3.00
+ Test::More: 0.62
+no_index:
+ directory:
+ - t
+ - inc
+generated_by: ExtUtils::MakeMaker version 6.48
meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.3.html
- version: 1.3
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
Modified: branches/upstream/libmodule-pluggable-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmodule-pluggable-perl/current/Makefile.PL?rev=33281&op=diff
==============================================================================
--- branches/upstream/libmodule-pluggable-perl/current/Makefile.PL (original)
+++ branches/upstream/libmodule-pluggable-perl/current/Makefile.PL Wed Apr 15 17:58:52 2009
@@ -17,13 +17,13 @@
"t", "Module_Pluggable") : ($FindBin::Bin,"t");
my @files;
-if ($^O ne 'VMS' && $^O ne 'VOS') {
+unless (grep { lc($^O) eq $_ } qw(vms vos)) {
foreach my $test (keys %dodgy_files) {
- my ($file) = (catfile($FindBin::Bin,"t","lib", $test)=~/^(.*)$/);
- if (open(my $fh, ">", $file)) {
+ my ($file) = (catfile(@path, "lib", $test)=~/^(.*)$/);
+ if (open(FH, ">$file")) {
my $name = $dodgy_files{$test};
- print $fh "package $name;\nsub new {}\n1;";
- close($fh);
+ print FH "package $name;\nsub new {}\n1;";
+ close(FH);
push @files, $file;
}
}
@@ -41,6 +41,7 @@
},
'EXE_FILES' => [],
'INSTALLDIRS' => ($] >= 5.008009) ? "perl" : "site",
+ 'INST_LIB' => ($] >= 5.008009) ? 'blib/arch' : 'blib/lib',
'PL_FILES' => {},
'realclean' => {FILES=> join ' ', @files},
# In the core pods will be built by installman.
Modified: branches/upstream/libmodule-pluggable-perl/current/lib/Module/Pluggable.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmodule-pluggable-perl/current/lib/Module/Pluggable.pm?rev=33281&op=diff
==============================================================================
--- branches/upstream/libmodule-pluggable-perl/current/lib/Module/Pluggable.pm (original)
+++ branches/upstream/libmodule-pluggable-perl/current/lib/Module/Pluggable.pm Wed Apr 15 17:58:52 2009
@@ -9,7 +9,7 @@
# Peter Gibbons: I wouldn't say I've been missing it, Bob!
-$VERSION = '3.8';
+$VERSION = '3.9';
sub import {
my $class = shift;
Modified: branches/upstream/libmodule-pluggable-perl/current/lib/Module/Pluggable/Object.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmodule-pluggable-perl/current/lib/Module/Pluggable/Object.pm?rev=33281&op=diff
==============================================================================
--- branches/upstream/libmodule-pluggable-perl/current/lib/Module/Pluggable/Object.pm (original)
+++ branches/upstream/libmodule-pluggable-perl/current/lib/Module/Pluggable/Object.pm Wed Apr 15 17:58:52 2009
@@ -6,10 +6,9 @@
use File::Spec::Functions qw(splitdir catdir curdir catfile abs2rel);
use Carp qw(croak carp);
use Devel::InnerPackage;
-use Data::Dumper;
use vars qw($VERSION);
-$VERSION = '3.6';
+$VERSION = '3.9';
sub new {
@@ -34,14 +33,14 @@
my $filename = $self->{'filename'};
my $pkg = $self->{'package'};
+ # Get the exception params instantiated
+ $self->_setup_exceptions;
+
# automatically turn a scalar search path or namespace into a arrayref
for (qw(search_path search_dirs)) {
$self->{$_} = [ $self->{$_} ] if exists $self->{$_} && !ref($self->{$_});
}
-
-
-
# default search path is '<Module>::<Name>::Plugin'
$self->{'search_path'} = ["${pkg}::Plugin"] unless $self->{'search_path'};
@@ -57,6 +56,7 @@
my @plugins = $self->search_directories(@SEARCHDIR);
+ push(@plugins, $self->handle_innerpackages($_)) for @{$self->{'search_path'}};
# push @plugins, map { print STDERR "$_\n"; $_->require } list_packages($_) for (@{$self->{'search_path'}});
@@ -64,43 +64,12 @@
return () unless @plugins;
- # exceptions
- my %only;
- my %except;
- my $only;
- my $except;
-
- if (defined $self->{'only'}) {
- if (ref($self->{'only'}) eq 'ARRAY') {
- %only = map { $_ => 1 } @{$self->{'only'}};
- } elsif (ref($self->{'only'}) eq 'Regexp') {
- $only = $self->{'only'}
- } elsif (ref($self->{'only'}) eq '') {
- $only{$self->{'only'}} = 1;
- }
- }
-
-
- if (defined $self->{'except'}) {
- if (ref($self->{'except'}) eq 'ARRAY') {
- %except = map { $_ => 1 } @{$self->{'except'}};
- } elsif (ref($self->{'except'}) eq 'Regexp') {
- $except = $self->{'except'}
- } elsif (ref($self->{'except'}) eq '') {
- $except{$self->{'except'}} = 1;
- }
- }
-
# remove duplicates
# probably not necessary but hey ho
my %plugins;
for(@plugins) {
- next if (keys %only && !$only{$_} );
- next unless (!defined $only || m!$only! );
-
- next if (keys %except && $except{$_} );
- next if (defined $except && m!$except! );
+ next unless $self->_is_legit($_);
$plugins{$_} = 1;
}
@@ -116,6 +85,58 @@
}
+sub _setup_exceptions {
+ my $self = shift;
+
+ my %only;
+ my %except;
+ my $only;
+ my $except;
+
+ if (defined $self->{'only'}) {
+ if (ref($self->{'only'}) eq 'ARRAY') {
+ %only = map { $_ => 1 } @{$self->{'only'}};
+ } elsif (ref($self->{'only'}) eq 'Regexp') {
+ $only = $self->{'only'}
+ } elsif (ref($self->{'only'}) eq '') {
+ $only{$self->{'only'}} = 1;
+ }
+ }
+
+
+ if (defined $self->{'except'}) {
+ if (ref($self->{'except'}) eq 'ARRAY') {
+ %except = map { $_ => 1 } @{$self->{'except'}};
+ } elsif (ref($self->{'except'}) eq 'Regexp') {
+ $except = $self->{'except'}
+ } elsif (ref($self->{'except'}) eq '') {
+ $except{$self->{'except'}} = 1;
+ }
+ }
+ $self->{_exceptions}->{only_hash} = \%only;
+ $self->{_exceptions}->{only} = $only;
+ $self->{_exceptions}->{except_hash} = \%except;
+ $self->{_exceptions}->{except} = $except;
+
+}
+
+sub _is_legit {
+ my $self = shift;
+ my $plugin = shift;
+ my %only = %{$self->{_exceptions}->{only_hash}||{}};
+ my %except = %{$self->{_exceptions}->{except_hash}||{}};
+ my $only = $self->{_exceptions}->{only};
+ my $except = $self->{_exceptions}->{except};
+
+ return 0 if (keys %only && !$only{$plugin} );
+ return 0 unless (!defined $only || $plugin =~ m!$only! );
+
+ return 0 if (keys %except && $except{$plugin} );
+ return 0 if (defined $except && $plugin =~ m!$except! );
+
+ return 1;
+}
+
sub search_directories {
my $self = shift;
my @SEARCHDIR = @_;
@@ -125,7 +146,6 @@
foreach my $dir (@SEARCHDIR) {
push @plugins, $self->search_paths($dir);
}
-
return @plugins;
}
@@ -209,7 +229,7 @@
# now add stuff that may have been in package
# NOTE we should probably use all the stuff we've been given already
# but then we can't unload it :(
- push @plugins, $self->handle_innerpackages($searchpath) unless (exists $self->{inner} && !$self->{inner});
+ push @plugins, $self->handle_innerpackages($searchpath);
} # foreach $searchpath
return @plugins;
@@ -236,6 +256,7 @@
my $plugin = shift;
return unless (defined $self->{'instantiate'} || $self->{'require'});
+ return unless $self->_is_legit($plugin);
$self->_require($plugin);
}
@@ -267,9 +288,10 @@
sub handle_innerpackages {
my $self = shift;
+ return () if (exists $self->{inner} && !$self->{inner});
+
my $path = shift;
my @plugins;
-
foreach my $plugin (Devel::InnerPackage::list_packages($path)) {
my $err = $self->handle_finding_plugin($plugin);
Added: branches/upstream/libmodule-pluggable-perl/current/t/10innerpack_onefile.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmodule-pluggable-perl/current/t/10innerpack_onefile.t?rev=33281&op=file
==============================================================================
--- branches/upstream/libmodule-pluggable-perl/current/t/10innerpack_onefile.t (added)
+++ branches/upstream/libmodule-pluggable-perl/current/t/10innerpack_onefile.t Wed Apr 15 17:58:52 2009
@@ -1,0 +1,27 @@
+#!perl -wT
+
+use strict;
+use Test::More tests => 2;
+use Data::Dumper;
+
+my $mc = MyClass->new();
+my $mc2 = MyClass2->new();
+
+
+is_deeply([$mc->plugins], [qw(MyClass::Plugin::MyPlugin)], "Got inner plugin");
+is_deeply([$mc2->plugins], [], "Didn't get plugin");
+
+package MyClass::Plugin::MyPlugin;
+sub pretty { print "I am pretty" };
+
+package MyClass;
+use Module::Pluggable inner => 1;
+
+sub new { return bless {}, $_[0] }
+
+package MyClass2;
+use Module::Pluggable search_path => "MyClass::Plugin", inner => 0;
+
+sub new { return bless {}, $_[0] }
+1;
+
Added: branches/upstream/libmodule-pluggable-perl/current/t/12onlyrequire.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmodule-pluggable-perl/current/t/12onlyrequire.t?rev=33281&op=file
==============================================================================
--- branches/upstream/libmodule-pluggable-perl/current/t/12onlyrequire.t (added)
+++ branches/upstream/libmodule-pluggable-perl/current/t/12onlyrequire.t Wed Apr 15 17:58:52 2009
@@ -1,0 +1,21 @@
+#!perl -w
+use strict;
+use FindBin;
+use lib (($FindBin::Bin."/lib")=~/^(.*)$/);
+use Test::More tests => 2;
+
+my @packages = eval { Zot->_dist_types };
+is($@, '', "No warnings");
+is(scalar(@packages), 0, "Correctly only got 1 package");
+
+
+package Zot;
+use strict;
+use Module::Pluggable (
+ sub_name => '_dist_types',
+ search_path => __PACKAGE__,
+ only => qr/Zot::\w+$/,
+ require => 1,
+ );
+
+1;
Added: branches/upstream/libmodule-pluggable-perl/current/t/lib/Acme/Foo-Bar.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmodule-pluggable-perl/current/t/lib/Acme/Foo-Bar.pm?rev=33281&op=file
==============================================================================
--- branches/upstream/libmodule-pluggable-perl/current/t/lib/Acme/Foo-Bar.pm (added)
+++ branches/upstream/libmodule-pluggable-perl/current/t/lib/Acme/Foo-Bar.pm Wed Apr 15 17:58:52 2009
@@ -1,0 +1,6 @@
+package Acme::FooBar;
+
+our $quux = "hello";
+
+1;
+
Added: branches/upstream/libmodule-pluggable-perl/current/t/lib/Zot/.Zork.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmodule-pluggable-perl/current/t/lib/Zot/.Zork.pm?rev=33281&op=file
==============================================================================
(empty)
More information about the Pkg-perl-cvs-commits
mailing list