1. Toby Inkster
  2. p5-object-authority

Commits

Toby Inkster  committed f352564

Use Object::Role

  • Participants
  • Parent commits 1931ade
  • Branches default

Comments (0)

Files changed (3)

File lib/Object/AUTHORITY.pm

View file
 
 BEGIN {
 	$Object::AUTHORITY::AUTHORITY = 'cpan:TOBYINK';
-	$Object::AUTHORITY::VERSION   = '0.002';
+	$Object::AUTHORITY::VERSION   = '0.003';
 }
 
+use base qw/Object::Role/;
+
 use Carp qw[croak];
 use Scalar::Util qw[blessed];
-use Sub::Name qw[subname];
 
 sub import
 {
-	my ($invocant, @args) = @_;
-	
-	my %args;
-	while (defined(my $arg = shift @args))
-	{
-		if ($arg =~ /^-/)
-		{
-			$args{$arg} = shift @args;
-		}
-		else
-		{
-			push @{$args{-method}}, $arg;
-		}
-	}
-	
-	my $package = $args{-package} // caller;
+	my ($class, @args) = @_;
+	my ($package, %args) = $class->parse_arguments(-method => @args);
 	$package = [$package] unless ref $package;
-	
-	for my $caller (@$package)
-	{
-		no strict 'refs';
-		my $name = "$caller\::AUTHORITY";
-		*$name = my $ref = subname($name, \&AUTHORITY);
-	}
+	$class->install_method(AUTHORITY => \&AUTHORITY, $_) foreach @$package;
 }
 
 sub AUTHORITY

File meta/changes.ttl

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

File meta/makefile.ttl

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