line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
600
|
use 5.006; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
38
|
|
2
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
24
|
|
3
|
1
|
|
|
1
|
|
11
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
37
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Attribute::SubName; |
6
|
|
|
|
|
|
|
BEGIN { |
7
|
1
|
|
|
1
|
|
20
|
$Attribute::SubName::VERSION = '1.101420'; |
8
|
|
|
|
|
|
|
} |
9
|
|
|
|
|
|
|
# ABSTRACT: Naming anonymous subroutines via attributes |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
783
|
use Sub::Name; |
|
1
|
|
|
|
|
1080
|
|
|
1
|
|
|
|
|
53
|
|
12
|
1
|
|
|
1
|
|
853
|
use parent 'Attribute::Handlers'; |
|
1
|
|
|
|
|
298
|
|
|
1
|
|
|
|
|
6
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub UNIVERSAL::Name : ATTR(CODE) { |
15
|
1
|
|
|
1
|
0
|
27551
|
my ($package, $symbol, $referent, $attr, $data, $phase) = @_; |
16
|
1
|
50
|
|
|
|
8
|
$data = [$data] unless ref $data eq 'ARRAY'; |
17
|
1
|
|
|
|
|
3
|
for my $item (@$data) { |
18
|
1
|
|
|
|
|
4
|
my $name = "${package}::${item}"; |
19
|
1
|
|
|
|
|
20
|
subname $name => $referent; |
20
|
1
|
|
|
1
|
|
7532
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
50
|
|
21
|
1
|
|
|
|
|
2
|
*{$name} = $referent; |
|
1
|
|
|
|
|
78
|
|
22
|
|
|
|
|
|
|
} |
23
|
1
|
|
|
1
|
|
6
|
} |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
24
|
|
|
|
|
|
|
1; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
__END__ |