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