line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::Digest::SHA1; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
218109
|
use strict; |
|
6
|
|
|
|
|
37
|
|
|
6
|
|
|
|
|
255
|
|
4
|
6
|
|
|
6
|
|
34
|
use warnings; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
211
|
|
5
|
6
|
|
|
6
|
|
29
|
use vars qw($VERSION); |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
460
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$VERSION = 0.04; |
8
|
|
|
|
|
|
|
|
9
|
6
|
|
|
6
|
|
33
|
use base qw(Template::Plugin); |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
7254
|
|
10
|
6
|
|
|
6
|
|
32226
|
use Template::Plugin; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
162
|
|
11
|
6
|
|
|
6
|
|
5289
|
use Template::Stash; |
|
6
|
|
|
|
|
102216
|
|
|
6
|
|
|
|
|
255
|
|
12
|
6
|
|
|
6
|
|
12163
|
use Digest::SHA1 qw(sha1 sha1_hex sha1_base64); |
|
6
|
|
|
|
|
7993
|
|
|
6
|
|
|
|
|
10878
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
$Template::Stash::SCALAR_OPS->{'sha1'} = \&_sha1; |
15
|
|
|
|
|
|
|
$Template::Stash::SCALAR_OPS->{'sha1_hex'} = \&_sha1_hex; |
16
|
|
|
|
|
|
|
$Template::Stash::SCALAR_OPS->{'sha1_base64'} = \&_sha1_base64; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
19
|
6
|
|
|
6
|
1
|
23989
|
my ($class, $context, $options) = @_; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# now define the filter and return the plugin |
22
|
6
|
|
|
|
|
39
|
$context->define_filter('sha1', \&_sha1); |
23
|
6
|
|
|
|
|
142
|
$context->define_filter('sha1_hex', \&_sha1_hex); |
24
|
6
|
|
|
|
|
138
|
$context->define_filter('sha1_base64', \&_sha1_base64); |
25
|
6
|
|
|
|
|
157
|
return bless {}, $class; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _sha1 { |
29
|
4
|
50
|
|
4
|
|
12487
|
my $options = ref $_[-1] eq 'HASH' ? pop : {}; |
30
|
4
|
|
|
|
|
63
|
return sha1(join('', @_)); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _sha1_hex { |
34
|
7
|
50
|
|
7
|
|
488
|
my $options = ref $_[-1] eq 'HASH' ? pop : {}; |
35
|
7
|
|
|
|
|
96
|
return sha1_hex(join('', @_)); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub _sha1_base64 { |
39
|
3
|
50
|
|
3
|
|
312
|
my $options = ref $_[-1] eq 'HASH' ? pop : {}; |
40
|
3
|
|
|
|
|
48
|
return sha1_base64(join('', @_)); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__END__ |