r34748 - in /branches/upstream/libmoosex-object-pluggable-perl/current: ./ inc/Module/ inc/Module/Install/ lib/MooseX/Object/ t/

bricas-guest at users.alioth.debian.org bricas-guest at users.alioth.debian.org
Mon May 4 13:13:55 UTC 2009


Author: bricas-guest
Date: Mon May  4 13:13:23 2009
New Revision: 34748

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=34748
Log:
[svn-upgrade] Integrating new upstream version, libmoosex-object-pluggable-perl (0.0011)

Modified:
    branches/upstream/libmoosex-object-pluggable-perl/current/Changes
    branches/upstream/libmoosex-object-pluggable-perl/current/META.yml
    branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/AutoInstall.pm
    branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install.pm
    branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/AutoInstall.pm
    branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Base.pm
    branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Can.pm
    branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Fetch.pm
    branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Include.pm
    branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Makefile.pm
    branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Metadata.pm
    branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Win32.pm
    branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/WriteAll.pm
    branches/upstream/libmoosex-object-pluggable-perl/current/lib/MooseX/Object/Pluggable.pm
    branches/upstream/libmoosex-object-pluggable-perl/current/t/01-basic.t

Modified: branches/upstream/libmoosex-object-pluggable-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-object-pluggable-perl/current/Changes?rev=34748&op=diff
==============================================================================
--- branches/upstream/libmoosex-object-pluggable-perl/current/Changes (original)
+++ branches/upstream/libmoosex-object-pluggable-perl/current/Changes Mon May  4 13:13:23 2009
@@ -1,4 +1,10 @@
 Revision history for MooseX-Object-Pluggable
+0.0011    Apr 27, 2009
+          Version number FAIL on last release
+
+0.0010    Apr 27, 2009
+          Change how _original_class_name works so it sucks less.
+
 0.0009    Nov 25, 2008
           Avoid throwing an error when load_plugins is called on already-loaded
               plugins

Modified: branches/upstream/libmoosex-object-pluggable-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-object-pluggable-perl/current/META.yml?rev=34748&op=diff
==============================================================================
--- branches/upstream/libmoosex-object-pluggable-perl/current/META.yml (original)
+++ branches/upstream/libmoosex-object-pluggable-perl/current/META.yml Mon May  4 13:13:23 2009
@@ -5,7 +5,7 @@
 build_requires:
   Test::More: 0
 distribution_type: module
-generated_by: 'Module::Install version 0.76'
+generated_by: 'Module::Install version 0.80'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -20,4 +20,4 @@
   Moose: 0.35
 resources:
   license: http://dev.perl.org/licenses/
-version: 0.0009
+version: 0.0011

Modified: branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/AutoInstall.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/AutoInstall.pm?rev=34748&op=diff
==============================================================================
--- branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/AutoInstall.pm (original)
+++ branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/AutoInstall.pm Mon May  4 13:13:23 2009
@@ -184,6 +184,7 @@
             !$SkipInstall
             and (
                 $CheckOnly
+                or ($mandatory and $ENV{PERL5_CPANPLUS_IS_RUNNING})
                 or _prompt(
                     qq{==> Auto-install the }
                       . ( @required / 2 )
@@ -765,4 +766,4 @@
 
 __END__
 
-#line 1003
+#line 1004

Modified: branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install.pm?rev=34748&op=diff
==============================================================================
--- branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install.pm (original)
+++ branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install.pm Mon May  4 13:13:23 2009
@@ -30,7 +30,7 @@
 	# This is not enforced yet, but will be some time in the next few
 	# releases once we can make sure it won't clash with custom
 	# Module::Install extensions.
-	$VERSION = '0.76';
+	$VERSION = '0.80';
 
 	*inc::Module::Install::VERSION = *VERSION;
 	@inc::Module::Install::ISA     = __PACKAGE__;
@@ -125,8 +125,10 @@
 			goto &$code unless $cwd eq $pwd;
 		}
 		$$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym";
-		unshift @_, ( $self, $1 );
-		goto &{$self->can('call')} unless uc($1) eq $1;
+		unless ( uc($1) eq $1 ) {
+			unshift @_, ( $self, $1 );
+			goto &{$self->can('call')};
+		}
 	};
 }
 
@@ -248,7 +250,7 @@
 sub load_extensions {
 	my ($self, $path, $top) = @_;
 
-	unless ( grep { lc $_ eq lc $self->{prefix} } @INC ) {
+	unless ( grep { !ref $_ and lc $_ eq lc $self->{prefix} } @INC ) {
 		unshift @INC, $self->{prefix};
 	}
 
@@ -339,6 +341,9 @@
 	close FH or die "close($_[0]): $!";
 }
 
+# _version is for processing module versions (eg, 1.03_05) not
+# Perl versions (eg, 5.8.1).
+
 sub _version ($) {
 	my $s = shift || 0;
 	   $s =~ s/^(\d+)\.?//;
@@ -355,10 +360,10 @@
 		and
 		! ref $_[0]
 		and
-		$_[0] =~ m/^[^\W\d]\w*(?:::\w+)*$/s
+		$_[0] =~ m/^[^\W\d]\w*(?:::\w+)*\z/s
 	) ? $_[0] : undef;
 }
 
 1;
 
-# Copyright 2008 Adam Kennedy.
+# Copyright 2008 - 2009 Adam Kennedy.

Modified: branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/AutoInstall.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/AutoInstall.pm?rev=34748&op=diff
==============================================================================
--- branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/AutoInstall.pm (original)
+++ branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/AutoInstall.pm Mon May  4 13:13:23 2009
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.76';
+	$VERSION = '0.80';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }

Modified: branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Base.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Base.pm?rev=34748&op=diff
==============================================================================
--- branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Base.pm (original)
+++ branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Base.pm Mon May  4 13:13:23 2009
@@ -1,7 +1,7 @@
 #line 1
 package Module::Install::Base;
 
-$VERSION = '0.76';
+$VERSION = '0.80';
 
 # Suspend handler for "redefined" warnings
 BEGIN {

Modified: branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Can.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Can.pm?rev=34748&op=diff
==============================================================================
--- branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Can.pm (original)
+++ branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Can.pm Mon May  4 13:13:23 2009
@@ -11,7 +11,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.76';
+	$VERSION = '0.80';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }
@@ -39,6 +39,7 @@
 	return $_cmd if (-x $_cmd or $_cmd = MM->maybe_command($_cmd));
 
 	for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
+		next if $dir eq '';
 		my $abs = File::Spec->catfile($dir, $_[1]);
 		return $abs if (-x $abs or $abs = MM->maybe_command($abs));
 	}
@@ -79,4 +80,4 @@
 
 __END__
 
-#line 157
+#line 158

Modified: branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Fetch.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Fetch.pm?rev=34748&op=diff
==============================================================================
--- branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Fetch.pm (original)
+++ branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Fetch.pm Mon May  4 13:13:23 2009
@@ -6,20 +6,20 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.76';
+	$VERSION = '0.80';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }
 
 sub get_file {
     my ($self, %args) = @_;
-    my ($scheme, $host, $path, $file) = 
+    my ($scheme, $host, $path, $file) =
         $args{url} =~ m|^(\w+)://([^/]+)(.+)/(.+)| or return;
 
     if ( $scheme eq 'http' and ! eval { require LWP::Simple; 1 } ) {
         $args{url} = $args{ftp_url}
             or (warn("LWP support unavailable!\n"), return);
-        ($scheme, $host, $path, $file) = 
+        ($scheme, $host, $path, $file) =
             $args{url} =~ m|^(\w+)://([^/]+)(.+)/(.+)| or return;
     }
 

Modified: branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Include.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Include.pm?rev=34748&op=diff
==============================================================================
--- branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Include.pm (original)
+++ branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Include.pm Mon May  4 13:13:23 2009
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.76';
+	$VERSION = '0.80';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }

Modified: branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Makefile.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Makefile.pm?rev=34748&op=diff
==============================================================================
--- branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Makefile.pm (original)
+++ branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Makefile.pm Mon May  4 13:13:23 2009
@@ -7,7 +7,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.76';
+	$VERSION = '0.80';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }
@@ -64,7 +64,7 @@
 	my $self  = shift;
 	my $clean = $self->makemaker_args->{clean} ||= {};
 	  %$clean = (
-		%$clean, 
+		%$clean,
 		FILES => join ' ', grep { length $_ } ($clean->{FILES} || (), @_),
 	);
 }
@@ -73,7 +73,7 @@
 	my $self      = shift;
 	my $realclean = $self->makemaker_args->{realclean} ||= {};
 	  %$realclean = (
-		%$realclean, 
+		%$realclean,
 		FILES => join ' ', grep { length $_ } ($realclean->{FILES} || (), @_),
 	);
 }
@@ -124,7 +124,7 @@
 
 	$self->configure_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/ );
 
-	# Generate the 
+	# Generate the
 	my $args = $self->makemaker_args;
 	$args->{DISTNAME} = $self->name;
 	$args->{NAME}     = $self->module_name || $self->name;
@@ -181,7 +181,9 @@
 
 	my $user_preop = delete $args{dist}->{PREOP};
 	if (my $preop = $self->admin->preop($user_preop)) {
-		$args{dist} = $preop;
+		foreach my $key ( keys %$preop ) {
+			$args{dist}->{$key} = $preop->{$key};
+		}
 	}
 
 	my $mm = ExtUtils::MakeMaker::WriteMakefile(%args);
@@ -194,7 +196,7 @@
 	my $top_class     = ref($self->_top) || '';
 	my $top_version   = $self->_top->VERSION || '';
 
-	my $preamble = $self->preamble 
+	my $preamble = $self->preamble
 		? "# Preamble by $top_class $top_version\n"
 			. $self->preamble
 		: '';
@@ -248,4 +250,4 @@
 
 __END__
 
-#line 377
+#line 379

Modified: branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Metadata.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Metadata.pm?rev=34748&op=diff
==============================================================================
--- branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Metadata.pm (original)
+++ branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Metadata.pm Mon May  4 13:13:23 2009
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-	$VERSION = '0.76';
+	$VERSION = '0.80';
 	$ISCORE  = 1;
 	@ISA     = qw{Module::Install::Base};
 }
@@ -175,13 +175,16 @@
 	my $version = shift or die(
 		"Did not provide a value to perl_version()"
 	);
-	$version =~ s/_.+$//;
-	$version = $version + 0; # Numify
+
+	# Normalize the version
+	$version = $self->_perl_version($version);
+
+	# We don't support the reall old versions
 	unless ( $version >= 5.005 ) {
 		die "Module::Install only supports 5.005 or newer (use ExtUtils::MakeMaker)\n";
 	}
+
 	$self->{values}{perl_version} = $version;
-	return 1;
 }
 
 sub license {
@@ -212,6 +215,9 @@
 		unless ( -e $file ) {
 			die("all_from cannot find $file from $name");
 		}
+	}
+	unless ( -f $file ) {
+		die("The path '$file' does not exist, or is not a file");
 	}
 
 	# Some methods pull from POD instead of code.
@@ -424,8 +430,12 @@
 		my $license_text = $1;
 		my @phrases      = (
 			'under the same (?:terms|license) as perl itself' => 'perl',        1,
+			'GNU general public license'                      => 'gpl',         1,
 			'GNU public license'                              => 'gpl',         1,
+			'GNU lesser general public license'               => 'lgpl',        1,
 			'GNU lesser public license'                       => 'lgpl',        1,
+			'GNU library general public license'              => 'lgpl',        1,
+			'GNU library public license'                      => 'lgpl',        1,
 			'BSD license'                                     => 'bsd',         1,
 			'Artistic license'                                => 'artistic',    1,
 			'GPL'                                             => 'gpl',         1,
@@ -438,9 +448,6 @@
 		while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) {
 			$pattern =~ s{\s+}{\\s+}g;
 			if ( $license_text =~ /\b$pattern\b/i ) {
-				if ( $osi and $license_text =~ /All rights reserved/i ) {
-					print "WARNING: 'All rights reserved' in copyright may invalidate Open Source license.\n";
-				}
 				$self->license($license);
 				return 1;
 			}
@@ -469,19 +476,74 @@
 	return 1;
 }
 
-sub install_script {
-	my $self = shift;
-	my $args = $self->makemaker_args;
-	my $exe  = $args->{EXE_FILES} ||= [];
-        foreach ( @_ ) {
-		if ( -f $_ ) {
-			push @$exe, $_;
-		} elsif ( -d 'script' and -f "script/$_" ) {
-			push @$exe, "script/$_";
-		} else {
-			die("Cannot find script '$_'");
-		}
-	}
+# Convert triple-part versions (eg, 5.6.1 or 5.8.9) to
+# numbers (eg, 5.006001 or 5.008009).
+# Also, convert double-part versions (eg, 5.8)
+sub _perl_version {
+	my $v = $_[-1];
+	$v =~ s/^([1-9])\.([1-9]\d?\d?)$/sprintf("%d.%03d",$1,$2)/e;	
+	$v =~ s/^([1-9])\.([1-9]\d?\d?)\.(0|[1-9]\d?\d?)$/sprintf("%d.%03d%03d",$1,$2,$3 || 0)/e;
+	$v =~ s/(\.\d\d\d)000$/$1/;
+	$v =~ s/_.+$//;
+	if ( ref($v) ) {
+		$v = $v + 0; # Numify
+	}
+	return $v;
+}
+
+
+
+
+
+######################################################################
+# MYMETA.yml Support
+
+sub WriteMyMeta {
+	$_[0]->write_mymeta;
+}
+
+sub write_mymeta {
+	my $self = shift;
+	
+	# If there's no existing META.yml there is nothing we can do
+	return unless -f 'META.yml';
+
+	# We need YAML::Tiny to write the MYMETA.yml file
+	unless ( eval { require YAML::Tiny; 1; } ) {
+		return 1;
+	}
+
+	# Merge the perl version into the dependencies
+	my $val  = $self->Meta->{values};
+	my $perl = delete $val->{perl_version};
+	if ( $perl ) {
+		$val->{requires} ||= [];
+		my $requires = $val->{requires};
+
+		# Canonize to three-dot version after Perl 5.6
+		if ( $perl >= 5.006 ) {
+			$perl =~ s{^(\d+)\.(\d\d\d)(\d*)}{join('.', $1, int($2||0), int($3||0))}e
+		}
+		unshift @$requires, [ perl => $perl ];
+	}
+
+	# Load the advisory META.yml file
+	my @yaml = YAML::Tiny::LoadFile('META.yml');
+	my $meta = $yaml[0];
+
+	# Overwrite the non-configure dependency hashs
+	delete $meta->{requires};
+	delete $meta->{build_requires};
+	delete $meta->{recommends};
+	if ( exists $val->{requires} ) {
+		$meta->{requires} = { map { @$_ } @{ $val->{requires} } };
+	}
+	if ( exists $val->{build_requires} ) {
+		$meta->{build_requires} = { map { @$_ } @{ $val->{build_requires} } };
+	}
+
+	# Save as the MYMETA.yml file
+	YAML::Tiny::DumpFile('MYMETA.yml', $meta);
 }
 
 1;

Modified: branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Win32.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Win32.pm?rev=34748&op=diff
==============================================================================
--- branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Win32.pm (original)
+++ branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/Win32.pm Mon May  4 13:13:23 2009
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '0.76';
+	$VERSION = '0.80';
 	@ISA     = qw{Module::Install::Base};
 	$ISCORE  = 1;
 }

Modified: branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/WriteAll.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/WriteAll.pm?rev=34748&op=diff
==============================================================================
--- branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/WriteAll.pm (original)
+++ branches/upstream/libmoosex-object-pluggable-perl/current/inc/Module/Install/WriteAll.pm Mon May  4 13:13:23 2009
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '0.76';
+	$VERSION = '0.80';
 	@ISA     = qw{Module::Install::Base};
 	$ISCORE  = 1;
 }

Modified: branches/upstream/libmoosex-object-pluggable-perl/current/lib/MooseX/Object/Pluggable.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-object-pluggable-perl/current/lib/MooseX/Object/Pluggable.pm?rev=34748&op=diff
==============================================================================
--- branches/upstream/libmoosex-object-pluggable-perl/current/lib/MooseX/Object/Pluggable.pm (original)
+++ branches/upstream/libmoosex-object-pluggable-perl/current/lib/MooseX/Object/Pluggable.pm Mon May  4 13:13:23 2009
@@ -3,9 +3,10 @@
 use Carp;
 use Moose::Role;
 use Class::MOP;
+use Scalar::Util 'blessed';
 use Module::Pluggable::Object;
 
-our $VERSION = '0.0009';
+our $VERSION = '0.0011';
 
 =head1 NAME
 
@@ -87,54 +88,62 @@
 take presedence upon namespace collitions. This allows you to subclass a pluggable
 class and still use it's plugins while using yours first if they are available.
 
-=cut
-
 =head2 _plugin_locator
 
 An automatically built instance of L<Module::Pluggable::Object> used to locate
 available plugins.
 
+=head2 _original_class_name
+
+Because of the way roles apply C<$self-E<gt>blessed> and C<ref $self> will
+no longer return what you expect. Instead, upon instantiation, the name of the
+class instantiated will be stored in this attribute if you need to access the
+name the class held before any runtime roles were applied.
+
 =cut
 
 #--------#---------#---------#---------#---------#---------#---------#---------#
 
-has _plugin_ns =>
-  (
-   is => 'rw',
-   required => 1,
-   isa => 'Str',
-   default => sub{ 'Plugin' },
-  );
-
-has _plugin_loaded =>
-  (
-   is => 'rw',
-   required => 1,
-   isa => 'HashRef',
-   default => sub{ {} }
-  );
-
-has _plugin_app_ns =>
-  (
-   is => 'rw',
-   required => 1,
-   isa => 'ArrayRef',
-   lazy => 1,
-   auto_deref => 1,
-   builder => '_build_plugin_app_ns',
-   trigger => sub{ $_[0]->_clear_plugin_locator if $_[0]->_has_plugin_locator; },
-  );
-
-has _plugin_locator =>
-  (
-   is => 'rw',
-   required => 1,
-   lazy => 1,
-   isa => 'Module::Pluggable::Object',
-   clearer => '_clear_plugin_locator',
-   predicate => '_has_plugin_locator',
-   builder => '_build_plugin_locator'
-  );
+has _plugin_ns => (
+  is => 'rw',
+  required => 1,
+  isa => 'Str',
+  default => sub{ 'Plugin' },
+);
+
+has _original_class_name => (
+  is => 'ro',
+  required => 1,
+  isa => 'Str',
+  default => sub{ blessed($_[0]) },
+);
+
+has _plugin_loaded => (
+  is => 'rw',
+  required => 1,
+  isa => 'HashRef',
+  default => sub{ {} }
+);
+
+has _plugin_app_ns => (
+  is => 'rw',
+  required => 1,
+  isa => 'ArrayRef',
+  lazy => 1,
+  auto_deref => 1,
+  builder => '_build_plugin_app_ns',
+  trigger => sub{ $_[0]->_clear_plugin_locator if $_[0]->_has_plugin_locator; },
+);
+
+has _plugin_locator => (
+  is => 'rw',
+  required => 1,
+  lazy => 1,
+  isa => 'Module::Pluggable::Object',
+  clearer => '_clear_plugin_locator',
+  predicate => '_has_plugin_locator',
+  builder => '_build_plugin_locator'
+);
 
 #--------#---------#---------#---------#---------#---------#---------#---------#
 
@@ -172,20 +181,6 @@
   $self->load_plugins(@_);
 }
 
-=head2 _original_class_name
-
-Because of the way roles apply C<$self-E<gt>blessed> and C<ref $self> will
-no longer return what you expect. Instead use this class to get your original
-class name.
-
-=cut
-
-sub _original_class_name{
-    my $self = shift;
-    return (grep {$_ !~ /^Moose::/} $self->meta->class_precedence_list)[0];
-}
-
-
 =head1 Private Methods
 
 There's nothing stopping you from using these, but if you are using them

Modified: branches/upstream/libmoosex-object-pluggable-perl/current/t/01-basic.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-object-pluggable-perl/current/t/01-basic.t?rev=34748&op=diff
==============================================================================
--- branches/upstream/libmoosex-object-pluggable-perl/current/t/01-basic.t (original)
+++ branches/upstream/libmoosex-object-pluggable-perl/current/t/01-basic.t Mon May  4 13:13:23 2009
@@ -5,7 +5,7 @@
 use Test::More;
 use lib 't/lib';
 
-plan tests => 15;
+plan tests => 16;
 
 use_ok('TestApp');
 
@@ -17,14 +17,14 @@
 is($app->_role_from_plugin($_), 'TestApp::Plugin::'.$_)
     for(qw/Foo/);
 
-
-
 is( $app->foo, "original foo", 'original foo value');
 is( $app->bar, "original bar", 'original bar value');
 is( $app->bor, "original bor", 'original bor value');
 
 ok($app->load_plugin('Bar'), "Loaded Bar");
 is( $app->bar, "override bar", 'overridden bar via plugin');
+
+is( $app->_original_class_name, 'TestApp', '_original_class_name works');
 
 ok($app->load_plugin('Baz'), "Loaded Baz");
 is( $app->baz, "plugin baz", 'added baz via plugin');
@@ -36,3 +36,5 @@
 is( $app->bor, "plugin bor", 'override bor via plugin');
 
 #print $app->meta->dump(3);
+
+




More information about the Pkg-perl-cvs-commits mailing list