line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
95
|
|
|
95
|
|
1600
|
use 5.008; |
|
95
|
|
|
|
|
384
|
|
2
|
95
|
|
|
95
|
|
559
|
use strict; |
|
95
|
|
|
|
|
269
|
|
|
95
|
|
|
|
|
2233
|
|
3
|
95
|
|
|
95
|
|
527
|
use warnings; |
|
95
|
|
|
|
|
263
|
|
|
95
|
|
|
|
|
6300
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Sub::HandlesVia::HandlerLibrary; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
8
|
|
|
|
|
|
|
our $VERSION = '0.050000'; |
9
|
|
|
|
|
|
|
|
10
|
95
|
|
|
95
|
|
2038
|
use Types::Standard qw( Any Item ); |
|
95
|
|
|
|
|
229983
|
|
|
95
|
|
|
|
|
925
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub _type_inspector { |
13
|
568
|
|
|
568
|
|
1418
|
my ($me, $type) = @_; |
14
|
568
|
50
|
33
|
|
|
1747
|
if (!$type or $type == Any or $type == Item) { |
|
|
|
33
|
|
|
|
|
15
|
|
|
|
|
|
|
return { |
16
|
0
|
|
|
|
|
0
|
trust_mutated => 'always', |
17
|
|
|
|
|
|
|
}; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
568
|
|
|
|
|
636686
|
return { trust_mutated => 'never' }; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
{ |
24
|
|
|
|
|
|
|
my %cache; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub get_handler { |
27
|
4240
|
|
|
4240
|
0
|
8356
|
my ($me, $handler_name) = @_; |
28
|
4240
|
|
66
|
|
|
9849
|
$cache{$me} ||= $me->_populate_cache; |
29
|
4240
|
50
|
|
|
|
30748
|
$cache{$me}{$handler_name} ? $me->$handler_name : undef; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub has_handler { |
33
|
4226
|
|
|
4226
|
0
|
11267
|
my ($me, $handler_name) = @_; |
34
|
4226
|
|
66
|
|
|
11790
|
$cache{$me} ||= $me->_populate_cache; |
35
|
4226
|
|
|
|
|
21169
|
exists $cache{$me}{$handler_name}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# This is not necessarily an exhaustive list, however if it is non-exhaustive |
40
|
|
|
|
|
|
|
# then subclasses must override get_handler and has_handler. |
41
|
|
|
|
|
|
|
# |
42
|
|
|
|
|
|
|
sub handler_names { |
43
|
95
|
|
|
95
|
|
232128
|
no strict 'refs'; |
|
95
|
|
|
|
|
258
|
|
|
95
|
|
|
|
|
10342
|
|
44
|
97
|
|
|
97
|
0
|
397
|
@{ $_[0] . '::METHODS' } |
|
97
|
|
|
|
|
3986
|
|
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub _populate_cache { |
48
|
98
|
|
|
98
|
|
255
|
my %hash; |
49
|
98
|
|
|
|
|
746
|
$hash{$_} = 1 for $_[0]->handler_names; |
50
|
98
|
|
|
|
|
705
|
\%hash; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub expand_shortcut { |
54
|
95
|
|
|
95
|
|
697
|
use Carp; |
|
95
|
|
|
|
|
325
|
|
|
95
|
|
|
|
|
11271
|
|
55
|
0
|
|
|
0
|
0
|
0
|
Carp::croak( "Not implemented" ); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub preprocess_spec { |
59
|
336
|
|
|
336
|
0
|
1298
|
return; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |