| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package authority; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 2 |  |  | 2 |  | 23792 | use 5.006; | 
|  | 2 |  |  |  |  | 8 |  | 
|  | 2 |  |  |  |  | 91 |  | 
| 4 | 2 |  |  | 2 |  | 10 | use strict; | 
|  | 2 |  |  |  |  | 3 |  | 
|  | 2 |  |  |  |  | 112 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | BEGIN { | 
| 7 | 2 |  |  | 2 |  | 5 | $authority::AUTHORITY = 'cpan:TOBYINK'; | 
| 8 | 2 |  |  |  |  | 47 | $authority::VERSION   = '0.004'; | 
| 9 |  |  |  |  |  |  | } | 
| 10 |  |  |  |  |  |  |  | 
| 11 | 2 |  |  | 2 |  | 10 | use Carp 1.0 qw[]; | 
|  | 2 |  |  |  |  | 48 |  | 
|  | 2 |  |  |  |  | 40 |  | 
| 12 | 2 |  |  | 2 |  | 10 | use File::Spec 0.6 qw[]; | 
|  | 2 |  |  |  |  | 47 |  | 
|  | 2 |  |  |  |  | 54 |  | 
| 13 | 2 |  |  | 2 |  | 966 | use Object::AUTHORITY 0 qw[]; | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | sub import | 
| 16 |  |  |  |  |  |  | { | 
| 17 |  |  |  |  |  |  | use UNIVERSAL::AUTHORITY::Lexical; | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | my ($class, $authority, $module, @arguments) = @_; | 
| 20 |  |  |  |  |  |  | ($module, my $version) = split /\s+/, $module, 2; | 
| 21 |  |  |  |  |  |  | Carp::croak("Wrong number of arguments") unless defined $authority; | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | (my $file = "$module.pm") =~ s!::!/!g; | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | if ($authority =~ /^any$/i) | 
| 26 |  |  |  |  |  |  | { | 
| 27 |  |  |  |  |  |  | require $file; | 
| 28 |  |  |  |  |  |  | } | 
| 29 |  |  |  |  |  |  | else | 
| 30 |  |  |  |  |  |  | { | 
| 31 |  |  |  |  |  |  | my $authority_file = $authority; | 
| 32 |  |  |  |  |  |  | $authority_file =~ s/([^A-Za-z0-9])/sprintf('_%02X_', ord($1))/eg; | 
| 33 |  |  |  |  |  |  | $authority_file = File::Spec->catfile($authority_file, $file); | 
| 34 |  |  |  |  |  |  | eval { require $authority_file; 1 } or require $file; | 
| 35 |  |  |  |  |  |  | } | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | CHECKS: do { | 
| 38 |  |  |  |  |  |  | $Carp::CarpLevel++; | 
| 39 |  |  |  |  |  |  | $module->AUTHORITY($authority) | 
| 40 |  |  |  |  |  |  | unless $authority =~ /^any$/i; | 
| 41 |  |  |  |  |  |  | $module->VERSION($version) | 
| 42 |  |  |  |  |  |  | if defined $version; | 
| 43 |  |  |  |  |  |  | $Carp::CarpLevel--; | 
| 44 |  |  |  |  |  |  | }; | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | my $method = $module->can('import'); | 
| 47 |  |  |  |  |  |  | @_ = ($module, @arguments); | 
| 48 |  |  |  |  |  |  | goto &$method if $method; | 
| 49 |  |  |  |  |  |  | } | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | 1; | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | __END__ |