| 1 | package Template::Plugin::Digest::MD5; | ||||||||||
| 2 | |||||||||||
| 3 | 6 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 6 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 6 | ▶ | use vars qw($VERSION); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 6 | $VERSION = 0.05; | |||||||||
| 8 | |||||||||||
| 9 | 6 | ▶ | use base qw(Template::Plugin); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 6 | ▶ | use Template::Plugin; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 6 | ▶ | use Template::Stash; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 6 | ▶ | use Digest::MD5 qw(md5 md5_hex md5_base64); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | 6 | $Template::Stash::SCALAR_OPS->{'md5'} = \&_md5; | |||||||||
| 15 | 6 | $Template::Stash::SCALAR_OPS->{'md5_hex'} = \&_md5_hex; | |||||||||
| 16 | 6 | $Template::Stash::SCALAR_OPS->{'md5_base64'} = \&_md5_base64; | |||||||||
| 17 | |||||||||||
| 18 | 6 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 19 | 6 | my ($class, $context, $options) = @_; | |||||||||
| 20 | |||||||||||
| 21 | # now define the filter and return the plugin | ||||||||||
| 22 | 6 | $context->define_filter('md5', \&_md5); | |||||||||
| 23 | 6 | $context->define_filter('md5_hex', \&_md5_hex); | |||||||||
| 24 | 6 | $context->define_filter('md5_base64', \&_md5_base64); | |||||||||
| 25 | 6 | return bless {}, $class; | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 4 | ▶ | sub _md5 { | ||||||||
|
Subroutine
_md5: called CC=2 SCAR=7.2
| |||||||||||
| 29 | 4 | ▶ | my $options = ref $_[-1] eq 'HASH' ? pop : {}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | 4 | return md5(join('', @_)); | |||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | 7 | ▶ | sub _md5_hex { | ||||||||
|
Subroutine
_md5_hex: called CC=2 SCAR=7.2
| |||||||||||
| 34 | 7 | ▶ | my $options = ref $_[-1] eq 'HASH' ? pop : {}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | 7 | return md5_hex(join('', @_)); | |||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | 3 | ▶ | sub _md5_base64 { | ||||||||
|
Subroutine
_md5_base64: called CC=2 SCAR=7.2
| |||||||||||
| 39 | 3 | ▶ | my $options = ref $_[-1] eq 'HASH' ? pop : {}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | 3 | return md5_base64(join('', @_)); | |||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | 6 | 1; | |||||||||
| 44 | |||||||||||
| 45 | __END__ | ||||||||||