line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
4486
|
use v5.20.0; |
|
1
|
|
|
|
|
4
|
|
2
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: a moer tolernat verison of mehtod location |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Amce::CNA 0.069; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
6
|
use mro (); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
63
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# This experiment lands in 5.24 so it is safe to use from v5.20 onward. |
10
|
|
|
|
|
|
|
# -- rjbs, 2021-06-24 |
11
|
1
|
|
|
1
|
|
644
|
use if $] < 5.024, experimental => 'postderef'; |
|
1
|
|
|
|
|
13
|
|
|
1
|
|
|
|
|
6
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use Sub::Exporter -setup => { |
14
|
|
|
|
|
|
|
exports => [ |
15
|
|
|
|
|
|
|
qw(AUTOLOAD), |
16
|
2
|
|
|
|
|
1903
|
can => sub { \&__can }, |
17
|
1
|
|
|
|
|
16
|
], |
18
|
|
|
|
|
|
|
groups => [ default => [ qw(AUTOLOAD can) ] ], |
19
|
1
|
|
|
1
|
|
687
|
}; |
|
1
|
|
|
|
|
16758
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
#pod =head1 SYNOPSIS |
22
|
|
|
|
|
|
|
#pod |
23
|
|
|
|
|
|
|
#pod package Riddle::Tom; |
24
|
|
|
|
|
|
|
#pod use Amce::CNA; |
25
|
|
|
|
|
|
|
#pod |
26
|
|
|
|
|
|
|
#pod sub tom_marvolo_riddle { |
27
|
|
|
|
|
|
|
#pod return "That's me!"; |
28
|
|
|
|
|
|
|
#pod } |
29
|
|
|
|
|
|
|
#pod |
30
|
|
|
|
|
|
|
#pod And then... |
31
|
|
|
|
|
|
|
#pod |
32
|
|
|
|
|
|
|
#pod print Riddle::Tom->i_am_lord_voldemort; |
33
|
|
|
|
|
|
|
#pod # => "That's me!" |
34
|
|
|
|
|
|
|
#pod |
35
|
|
|
|
|
|
|
#pod O NOES! |
36
|
|
|
|
|
|
|
#pod |
37
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
38
|
|
|
|
|
|
|
#pod |
39
|
|
|
|
|
|
|
#pod This modlue makes it eaiser for dislexics to wriet workign Perl. |
40
|
|
|
|
|
|
|
#pod |
41
|
|
|
|
|
|
|
#pod =cut |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my %methods; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub _acroname { |
46
|
8
|
|
|
8
|
|
13
|
my ($name) = @_; |
47
|
|
|
|
|
|
|
|
48
|
8
|
|
|
|
|
37
|
my $acroname = join q{}, grep { $_ ne '_' } sort split //, $name; |
|
42
|
|
|
|
|
99
|
|
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub __can { |
52
|
3
|
|
|
3
|
|
2127
|
my ($class, $method) = @_; |
53
|
|
|
|
|
|
|
|
54
|
3
|
|
|
|
|
7
|
my $acroname = _acroname($method); |
55
|
|
|
|
|
|
|
|
56
|
3
|
|
|
|
|
18
|
my @path = mro::get_linear_isa($class)->@*; |
57
|
|
|
|
|
|
|
|
58
|
3
|
|
|
|
|
7
|
for my $pkg (@path) { |
59
|
3
|
|
33
|
|
|
15
|
$methods{$pkg} ||= _populate_methods($pkg); |
60
|
3
|
50
|
|
|
|
7
|
if (exists $methods{$pkg}{$acroname}) { |
61
|
3
|
|
|
|
|
310
|
return $methods{$pkg}{$acroname}; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
0
|
return; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub _populate_methods { |
69
|
3
|
|
|
3
|
|
16
|
my ($pkg) = @_; |
70
|
|
|
|
|
|
|
|
71
|
3
|
|
|
|
|
7
|
my $return = {}; |
72
|
|
|
|
|
|
|
|
73
|
3
|
|
|
|
|
9
|
my $stash = do { ## no critic (ConditionalDeclarations) |
74
|
1
|
|
|
1
|
|
1072
|
no strict 'refs'; ## no critic (NoStrict) |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
191
|
|
75
|
3
|
|
|
|
|
4
|
\%{"$pkg\::"}; |
|
3
|
|
|
|
|
9
|
|
76
|
|
|
|
|
|
|
}; |
77
|
|
|
|
|
|
|
|
78
|
3
|
|
|
|
|
9
|
for my $name (keys %$stash) { |
79
|
13
|
100
|
|
|
|
30
|
next if $name eq uc $name; |
80
|
9
|
100
|
|
|
|
11
|
if (exists &{"$pkg\::$name"}) { |
|
9
|
|
|
|
|
25
|
|
81
|
5
|
|
|
|
|
8
|
my $code = \&{$stash->{$name}}; |
|
5
|
|
|
|
|
18
|
|
82
|
5
|
|
33
|
|
|
14
|
$return->{_acroname($name)} ||= $code; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
3
|
|
|
|
|
10
|
return $return; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
my $error_msg = qq{Can\'t locate object method "%s" via package "%s" } . |
90
|
|
|
|
|
|
|
qq{at %s line %d.\n}; |
91
|
|
|
|
|
|
|
|
92
|
1
|
|
|
1
|
|
8
|
use vars qw($AUTOLOAD); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
243
|
|
93
|
|
|
|
|
|
|
sub AUTOLOAD { ## no critic Autoload |
94
|
2
|
|
|
2
|
|
841
|
my ($class, $method) = $AUTOLOAD =~ /^(.+)::([^:]+)$/; |
95
|
|
|
|
|
|
|
|
96
|
2
|
50
|
|
|
|
7
|
if (my $code = __can($class, $method)) { |
97
|
2
|
|
|
|
|
7
|
return $code->(@_); |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
0
|
0
|
|
|
|
|
Carp::croak "AUTOLOAD not called as method" unless @_ >= 1; |
101
|
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
my ($callpack, $callfile, $callline) = caller; |
103
|
|
|
|
|
|
|
## no critic Carp |
104
|
0
|
|
0
|
|
|
|
die sprintf $error_msg, $method, ((ref $_[0])||$_[0]), $callfile, $callline; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
#pod =begin :postlude |
108
|
|
|
|
|
|
|
#pod |
109
|
|
|
|
|
|
|
#pod =head1 TANKHS |
110
|
|
|
|
|
|
|
#pod |
111
|
|
|
|
|
|
|
#pod Hans Deiter Peercay, for laughing at the joek and rembemering the original |
112
|
|
|
|
|
|
|
#pod inpirsation for me. |
113
|
|
|
|
|
|
|
#pod |
114
|
|
|
|
|
|
|
#pod =head1 BUGS |
115
|
|
|
|
|
|
|
#pod |
116
|
|
|
|
|
|
|
#pod ueQit ysib.lpos |
117
|
|
|
|
|
|
|
#pod |
118
|
|
|
|
|
|
|
#pod =head1 ESE ASLO |
119
|
|
|
|
|
|
|
#pod |
120
|
|
|
|
|
|
|
#pod =over |
121
|
|
|
|
|
|
|
#pod |
122
|
|
|
|
|
|
|
#pod =item * |
123
|
|
|
|
|
|
|
#pod |
124
|
|
|
|
|
|
|
#pod L |
125
|
|
|
|
|
|
|
#pod |
126
|
|
|
|
|
|
|
#pod =back |
127
|
|
|
|
|
|
|
#pod |
128
|
|
|
|
|
|
|
#pod =head1 LINESCE |
129
|
|
|
|
|
|
|
#pod |
130
|
|
|
|
|
|
|
#pod This program is free weftsoar; you cna rdstrbteieiu it aond/r modfiy it ndeur |
131
|
|
|
|
|
|
|
#pod the saem terms as rePl etsilf. |
132
|
|
|
|
|
|
|
#pod |
133
|
|
|
|
|
|
|
#pod =end :postlude |
134
|
|
|
|
|
|
|
#pod |
135
|
|
|
|
|
|
|
#pod =cut |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
1; |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
__END__ |