line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::Digest::SHA1; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
136010
|
use strict; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
211
|
|
4
|
6
|
|
|
6
|
|
23
|
use warnings; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
175
|
|
5
|
6
|
|
|
6
|
|
21
|
use vars qw($VERSION); |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
337
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$VERSION = 0.05; |
8
|
|
|
|
|
|
|
|
9
|
6
|
|
|
6
|
|
27
|
use base qw(Template::Plugin); |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
3175
|
|
10
|
6
|
|
|
6
|
|
22091
|
use Template::Plugin; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
117
|
|
11
|
6
|
|
|
6
|
|
3550
|
use Template::Stash; |
|
6
|
|
|
|
|
68856
|
|
|
6
|
|
|
|
|
211
|
|
12
|
6
|
|
|
6
|
|
2755
|
use Digest::SHA1 qw(sha1 sha1_hex sha1_base64); |
|
6
|
|
|
|
|
3750
|
|
|
6
|
|
|
|
|
1677
|
|
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
|
15665
|
my ($class, $context, $options) = @_; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# now define the filter and return the plugin |
22
|
6
|
|
|
|
|
24
|
$context->define_filter('sha1', \&_sha1); |
23
|
6
|
|
|
|
|
102
|
$context->define_filter('sha1_hex', \&_sha1_hex); |
24
|
6
|
|
|
|
|
62
|
$context->define_filter('sha1_base64', \&_sha1_base64); |
25
|
6
|
|
|
|
|
65
|
return bless {}, $class; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _sha1 { |
29
|
4
|
50
|
|
4
|
|
6812
|
my $options = ref $_[-1] eq 'HASH' ? pop : {}; |
30
|
4
|
|
|
|
|
39
|
return sha1(join('', @_)); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _sha1_hex { |
34
|
7
|
50
|
|
7
|
|
179
|
my $options = ref $_[-1] eq 'HASH' ? pop : {}; |
35
|
7
|
|
|
|
|
60
|
return sha1_hex(join('', @_)); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub _sha1_base64 { |
39
|
3
|
50
|
|
3
|
|
106
|
my $options = ref $_[-1] eq 'HASH' ? pop : {}; |
40
|
3
|
|
|
|
|
35
|
return sha1_base64(join('', @_)); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__END__ |