line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
95
|
|
|
95
|
|
1621
|
use 5.008; |
|
95
|
|
|
|
|
390
|
|
2
|
95
|
|
|
95
|
|
568
|
use strict; |
|
95
|
|
|
|
|
240
|
|
|
95
|
|
|
|
|
2198
|
|
3
|
95
|
|
|
95
|
|
485
|
use warnings; |
|
95
|
|
|
|
|
278
|
|
|
95
|
|
|
|
|
6274
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Sub::HandlesVia::HandlerLibrary; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
8
|
|
|
|
|
|
|
our $VERSION = '0.046'; |
9
|
|
|
|
|
|
|
|
10
|
95
|
|
|
95
|
|
2065
|
use Types::Standard qw( Any Item ); |
|
95
|
|
|
|
|
217546
|
|
|
95
|
|
|
|
|
1002
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub _type_inspector { |
13
|
568
|
|
|
568
|
|
1494
|
my ($me, $type) = @_; |
14
|
568
|
50
|
33
|
|
|
1761
|
if (!$type or $type == Any or $type == Item) { |
|
|
|
33
|
|
|
|
|
15
|
|
|
|
|
|
|
return { |
16
|
0
|
|
|
|
|
0
|
trust_mutated => 'always', |
17
|
|
|
|
|
|
|
}; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
568
|
|
|
|
|
632371
|
return { trust_mutated => 'never' }; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
{ |
24
|
|
|
|
|
|
|
my %cache; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub get_handler { |
27
|
4240
|
|
|
4240
|
0
|
8465
|
my ($me, $handler_name) = @_; |
28
|
4240
|
|
66
|
|
|
10232
|
$cache{$me} ||= $me->_populate_cache; |
29
|
4240
|
50
|
|
|
|
33123
|
$cache{$me}{$handler_name} ? $me->$handler_name : undef; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub has_handler { |
33
|
4226
|
|
|
4226
|
0
|
11521
|
my ($me, $handler_name) = @_; |
34
|
4226
|
|
66
|
|
|
12314
|
$cache{$me} ||= $me->_populate_cache; |
35
|
4226
|
|
|
|
|
21269
|
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
|
|
238870
|
no strict 'refs'; |
|
95
|
|
|
|
|
271
|
|
|
95
|
|
|
|
|
11056
|
|
44
|
97
|
|
|
97
|
0
|
486
|
@{ $_[0] . '::METHODS' } |
|
97
|
|
|
|
|
4219
|
|
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub _populate_cache { |
48
|
98
|
|
|
98
|
|
274
|
my %hash; |
49
|
98
|
|
|
|
|
881
|
$hash{$_} = 1 for $_[0]->handler_names; |
50
|
98
|
|
|
|
|
686
|
\%hash; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub expand_shortcut { |
54
|
95
|
|
|
95
|
|
734
|
use Carp; |
|
95
|
|
|
|
|
264
|
|
|
95
|
|
|
|
|
11540
|
|
55
|
0
|
|
|
0
|
0
|
0
|
Carp::croak( "Not implemented" ); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub preprocess_spec { |
59
|
336
|
|
|
336
|
0
|
1318
|
return; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |