line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Cache::Keys::DSL; |
2
|
4
|
|
|
4
|
|
2354
|
use 5.008001; |
|
4
|
|
|
|
|
11
|
|
3
|
4
|
|
|
4
|
|
19
|
use strict; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
86
|
|
4
|
4
|
|
|
4
|
|
24
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
183
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = "0.01"; |
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
19
|
use Exporter 5.57 (); |
|
4
|
|
|
|
|
66
|
|
|
4
|
|
|
|
|
432
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub import { |
11
|
10
|
|
|
10
|
|
73
|
my ($class, %args) = @_; |
12
|
10
|
|
|
|
|
19
|
my $caller = caller; |
13
|
|
|
|
|
|
|
|
14
|
10
|
|
|
|
|
18
|
my $base_version = $args{base_version}; |
15
|
|
|
|
|
|
|
|
16
|
10
|
|
|
|
|
14
|
my %export; |
17
|
10
|
|
|
|
|
23
|
$export{key} = _key($base_version); |
18
|
10
|
|
|
|
|
26
|
$export{keygen} = _keygen($base_version); |
19
|
10
|
|
|
|
|
28
|
for my $name (keys %export) { |
20
|
20
|
|
|
|
|
30
|
my $code = $export{$name}; |
21
|
|
|
|
|
|
|
|
22
|
4
|
|
|
4
|
|
19
|
no strict qw/refs/; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
211
|
|
23
|
20
|
|
|
|
|
21
|
*{"${caller}::${name}"} = $code; |
|
20
|
|
|
|
|
98
|
|
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
4
|
|
|
4
|
|
19
|
no strict qw/refs/; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
122
|
|
27
|
4
|
|
|
4
|
|
19
|
no warnings qw/once/; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
1224
|
|
28
|
10
|
|
|
|
|
21
|
*{"${caller}::with_version"} = \&_with_version; |
|
10
|
|
|
|
|
46
|
|
29
|
10
|
|
|
|
|
23
|
@{"${caller}::EXPORT_OK"} = (); |
|
10
|
|
|
|
|
57
|
|
30
|
10
|
|
|
|
|
13
|
%{"${caller}::EXPORT_TAGS"} = (all => \@{"${caller}::EXPORT_OK"}); |
|
10
|
|
|
|
|
87
|
|
|
10
|
|
|
|
|
28
|
|
31
|
10
|
|
|
|
|
54
|
@{"${caller}::import"} = Exporter->can('import'); |
|
10
|
|
|
|
|
403
|
|
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub _with_version($$) {## no critic |
35
|
4
|
|
|
4
|
|
14
|
my $name = shift; |
36
|
4
|
|
|
|
|
5
|
my $version = shift; |
37
|
4
|
|
|
|
|
18
|
return [$name, $version]; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub _key { |
41
|
10
|
|
|
10
|
|
13
|
my $base_version = shift; |
42
|
|
|
|
|
|
|
return sub ($) { ## no critic |
43
|
5
|
|
|
5
|
|
21
|
my $name = shift; |
44
|
|
|
|
|
|
|
|
45
|
5
|
|
|
|
|
7
|
my @versions; |
46
|
5
|
100
|
|
|
|
22
|
($name, @versions) = @$name if ref $name eq 'ARRAY'; |
47
|
5
|
100
|
|
|
|
14
|
unshift @versions => $base_version if defined $base_version; |
48
|
|
|
|
|
|
|
|
49
|
5
|
|
|
|
|
11
|
my $caller = caller; |
50
|
5
|
|
|
|
|
12
|
my $subname = "key_for_$name"; |
51
|
5
|
|
|
|
|
49
|
my $value = join '_', $name, @versions; |
52
|
5
|
|
|
0
|
|
45
|
my $code = sub () { $value }; ## no critic |
|
0
|
|
|
|
|
0
|
|
53
|
|
|
|
|
|
|
{ |
54
|
4
|
|
|
4
|
|
20
|
no strict 'refs'; ## no critic |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
884
|
|
|
5
|
|
|
|
|
10
|
|
55
|
5
|
|
|
|
|
6
|
*{"${caller}::${subname}"} = $code; |
|
5
|
|
|
|
|
27
|
|
56
|
5
|
|
|
|
|
7
|
push @{"${caller}::EXPORT_OK"} => $subname; |
|
5
|
|
|
|
|
28
|
|
57
|
|
|
|
|
|
|
} |
58
|
10
|
|
|
|
|
86
|
}; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub _keygen { |
62
|
10
|
|
|
10
|
|
13
|
my $base_version = shift; |
63
|
|
|
|
|
|
|
return sub ($;&) { ## no critic |
64
|
5
|
|
|
5
|
|
37
|
my ($name, $generator) = @_; |
65
|
5
|
|
50
|
8
|
|
34
|
$generator ||= sub { @_ }; |
|
8
|
|
|
|
|
46
|
|
66
|
|
|
|
|
|
|
|
67
|
5
|
|
|
|
|
8
|
my @versions; |
68
|
5
|
100
|
|
|
|
19
|
($name, @versions) = @$name if ref $name eq 'ARRAY'; |
69
|
5
|
100
|
|
|
|
17
|
unshift @versions => $base_version if defined $base_version; |
70
|
|
|
|
|
|
|
|
71
|
5
|
|
|
|
|
11
|
my $caller = caller; |
72
|
5
|
|
|
|
|
31
|
my $subname = "gen_key_for_$name"; |
73
|
5
|
|
|
8
|
|
15
|
my $code = sub { join '_', $name, @versions, $generator->(@_) }; |
|
8
|
|
|
|
|
1539
|
|
74
|
|
|
|
|
|
|
{ |
75
|
4
|
|
|
4
|
|
20
|
no strict 'refs'; ## no critic |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
353
|
|
|
5
|
|
|
|
|
8
|
|
76
|
5
|
|
|
|
|
8
|
*{"${caller}::${subname}"} = $code; |
|
5
|
|
|
|
|
22
|
|
77
|
5
|
|
|
|
|
7
|
push @{"${caller}::EXPORT_OK"} => $subname; |
|
5
|
|
|
|
|
24
|
|
78
|
|
|
|
|
|
|
} |
79
|
10
|
|
|
|
|
49
|
}; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |
83
|
|
|
|
|
|
|
__END__ |