blib/lib/authority.pm

filter: Statementstmt 89.4% 17 / 19 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 92.3% 24 / 26 CC 1 SCAR 0.4
CC
1
Cov
89%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
↑ Summary
1 package authority;
2  
3 2 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 $authority::AUTHORITY = 'cpan:TOBYINK';
8 2 $authority::VERSION = '0.005';
9 }
10  
11 2 ▶use Carp 1.0 qw[];
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use File::Spec 0.6 qw[];
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 ▶use Object::AUTHORITY 0 qw[];
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 sub import
16 {
17 0 ▶ use UNIVERSAL::AUTHORITY::Lexical;
Subroutine BEGIN: called CC=1 SCAR=2.6
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__
↑ Summary