Commits

Toby Inkster committed dfd3426

Release 0.004

  • Participants
  • Parent commits f352564

Comments (0)

Files changed (3)

File lib/Object/AUTHORITY.pm

 
 BEGIN {
 	$Object::AUTHORITY::AUTHORITY = 'cpan:TOBYINK';
-	$Object::AUTHORITY::VERSION   = '0.003';
+	$Object::AUTHORITY::VERSION   = '0.004';
 }
 
 use base qw/Object::Role/;
-
 use Carp qw[croak];
 use Scalar::Util qw[blessed];
 
 sub import
 {
 	my ($class, @args) = @_;
-	my ($package, %args) = $class->parse_arguments(-method => @args);
-	$package = [$package] unless ref $package;
-	$class->install_method(AUTHORITY => \&AUTHORITY, $_) foreach @$package;
+	my ($caller, %args) = $class->parse_arguments(-method => @args);
+	$caller = [$caller] unless ref $caller;
+	$class->install_method(AUTHORITY => \&AUTHORITY, $_) foreach @$caller;
 }
 
 sub AUTHORITY
 		${"$invocant\::AUTHORITY"};
 		};
 	
-	if (scalar @_ > 1)
+	if (scalar @_ > 1 and not reasonably_smart_match($authority, $test))
 	{
-		if (defined $authority)
-		{
-			croak("Invocant ($invocant) has authority '$authority'")
-				unless reasonably_smart_match($authority, $test);
-		}
-		else
-		{
-			croak("Invocant ($invocant) has no authority defined")
-				unless reasonably_smart_match($authority, $test);
-		}
+		defined $authority
+			? croak("Invocant ($invocant) has authority '$authority'")
+			: croak("Invocant ($invocant) has no authority defined");
 	}
 	
 	return $authority;
 are various interesting use cases for custom C<AUTHORITY> methods, just as
 there are for custom C<can> and C<isa> methods.)
 
-The C<< $a >> parameter is assumed to be a scalar.
+The C<< $a >> parameter is always assumed to be a simple scalar.
 
 =back
 

File meta/changes.ttl

 		dcs:versus dist:v_0-002 ;
 		dcs:item   [ rdfs:label "Note dependency on Test::Exception."@en ; a dcs:Packaging , dcs:Bugfix ]
 		].
+
+dist:project :release dist:v_0-004 .
+dist:v_0-004
+	a               :Version ;
+	dc:issued       "2011-12-15"^^xsd:date ;
+	:revision       "0.004"^^xsd:string ;
+	:file-release   <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/Object-AUTHORITY-0.004.tar.gz> ;
+	dcs:changeset [
+		dcs:versus dist:v_0-003 ;
+		dcs:item   [ rdfs:label "use Object::Role"@en ]
+		].

File meta/makefile.ttl

 	:version_from _:main ;
 	:readme_from _:main ;
 	:test_requires "Test::More 0.61" , "Test::Exception" ;
-	:requires "Scalar::Util" , "Sub::Name" , "Carp" .
+	:requires "Scalar::Util" , "Object::Role" , "Carp" , "base" .
 
 _:main <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#fileName> "lib/Object/AUTHORITY.pm" .