Commits

Toby Inkster committed b876050

Use Object::Role

  • Participants
  • Parent commits 236d909

Comments (0)

Files changed (1)

File lib/authority/shared.pm

 	$authority::shared::VERSION   = '0.005';
 }
 
+use base qw/Object::Role/;
 use Carp qw(croak);
 use Scalar::Util qw(blessed);
-use Sub::Name qw(subname); # protects against namespace::autoclean.
 
 sub import
 {
-	shift if $_[0] eq __PACKAGE__;
-	my ($caller) = caller;
+	my ($class,  @args) = @_;
+	my ($caller, %args) = $class->parse_arguments(-authority => @args);
 	
-	no strict 'refs';
-	push @{"$caller\::AUTHORITIES"}, @_;
-	*{"$caller\::AUTHORITY"} = subname("$caller\::AUTHORITY", \&AUTHORITY);
+	{
+		no strict 'refs';
+		push @{"$caller\::AUTHORITIES"}, @{ $args{-authority} };
+	}
+	
+	$class->install_method(AUTHORITY => \&AUTHORITY, $caller);
 }
 
 sub AUTHORITY