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