line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Role::_Multiton; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
53886
|
use strict; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
210
|
|
4
|
6
|
|
|
6
|
|
33
|
use warnings; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
430
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
$Role::_Multiton::VERSION = '0.2'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub _get_multiton_lookup_hr { |
9
|
17
|
|
|
17
|
|
26
|
my ($self) = @_; |
10
|
17
|
|
50
|
|
|
109
|
my $class = ref($self) || $self || ''; |
11
|
|
|
|
|
|
|
|
12
|
6
|
|
|
6
|
|
31
|
no strict 'refs'; ## no critic |
|
6
|
|
|
|
|
23
|
|
|
6
|
|
|
|
|
2196
|
|
13
|
17
|
|
100
|
|
|
27
|
return ${ $class . '::_multitons' } ||= {}; |
|
17
|
|
|
|
|
154
|
|
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _get_arg_key { |
17
|
17
|
|
|
17
|
|
30
|
my ($arg_ar) = @_; |
18
|
17
|
|
|
|
|
25
|
my $arg_key; |
19
|
|
|
|
|
|
|
|
20
|
17
|
50
|
|
|
|
52
|
if ( !defined $arg_ar ) { |
21
|
0
|
|
|
|
|
0
|
$arg_ar = []; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
else { |
24
|
17
|
100
|
66
|
|
|
20
|
$arg_ar = [ map { $_ => $arg_ar->[0]{$_} } sort keys %{ $arg_ar->[0] } ] if @{$arg_ar} == 1 && ref( $arg_ar->[0] ) eq 'HASH'; |
|
2
|
|
|
|
|
17
|
|
|
2
|
|
|
|
|
13
|
|
|
17
|
|
|
|
|
101
|
|
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
17
|
|
|
|
|
26
|
for my $arg ( @{$arg_ar} ) { |
|
17
|
|
|
|
|
38
|
|
28
|
16
|
50
|
|
|
|
201
|
if ( !defined $arg ) { |
|
|
50
|
|
|
|
|
|
29
|
0
|
|
|
|
|
0
|
$arg_key .= 'undef(),'; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
elsif ( my $ref = ref($arg) ) { |
32
|
0
|
|
|
|
|
0
|
$arg_key .= "$ref($arg),"; # ? need to expand further or YAGNI ? |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
else { |
35
|
16
|
|
|
|
|
21
|
my $copy = $arg; |
36
|
16
|
|
|
|
|
29
|
$copy =~ s/'/\\'/g; |
37
|
16
|
|
|
|
|
50
|
$arg_key .= "'$copy',"; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
17
|
100
|
|
|
|
47
|
if ( defined $arg_key ) { |
42
|
8
|
|
|
|
|
28
|
$arg_key =~ s/,$//; |
43
|
8
|
|
|
|
|
33
|
return "($arg_key)"; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
else { |
46
|
9
|
|
|
|
|
35
|
return '()'; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__END__ |