line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
63081
|
use 5.016; |
|
3
|
|
|
|
|
13
|
|
2
|
3
|
|
|
3
|
|
15
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
86
|
|
3
|
3
|
|
|
3
|
|
13
|
use warnings FATAL => 'all'; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
187
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Attribute::Universal; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: Install attribute handlers directly into UNIVERSAL namespace |
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
3140
|
use Attribute::Handlers 0.99; |
|
3
|
|
|
|
|
16804
|
|
|
3
|
|
|
|
|
28
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.001'; # VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub import { |
14
|
3
|
|
|
3
|
|
24
|
my $class = shift; |
15
|
3
|
|
|
|
|
9
|
my $caller = scalar caller; |
16
|
3
|
|
|
|
|
13
|
my %cfg = @_; |
17
|
3
|
|
|
|
|
11
|
foreach my $name ( keys %cfg ) { |
18
|
6
|
|
|
|
|
15
|
my $cfg = uc( $cfg{$name} ); |
19
|
|
|
|
|
|
|
## no critic |
20
|
3
|
|
|
3
|
0
|
19
|
eval qq{ |
|
3
|
|
|
1
|
0
|
6
|
|
|
3
|
|
|
1
|
0
|
13
|
|
|
6
|
|
|
1
|
0
|
11785
|
|
|
1
|
|
|
1
|
0
|
5
|
|
|
1
|
|
|
1
|
|
2
|
|
|
1
|
|
|
1
|
|
6
|
|
|
1
|
|
|
1
|
|
915
|
|
|
1
|
|
|
5
|
|
13
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
754
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
4786
|
|
|
6
|
|
|
|
|
532
|
|
21
|
|
|
|
|
|
|
sub UNIVERSAL::$name : ATTR($cfg) { |
22
|
|
|
|
|
|
|
goto &${caller}::ATTRIBUTE; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
}; |
25
|
|
|
|
|
|
|
## use critic |
26
|
6
|
50
|
|
|
|
1645
|
die "cannot install universal attribute $name in $caller: $@" if $@; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
__END__ |