blib/lib/HTML/EP/CGIEncryptForm.pm untested

filter: Statementstmt 0.0% 0 / 39 Branchbran 0.0% 0 / 24 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 77 CC 13 SCAR 32.8
CC
13
Cov
0%
_handle
30.0
_ep_cef_encrypt
30.0
_ep_cef_decrypt
30.0
CRAP 26.7
1 use strict;
2  
3 use CGI::EncryptForm;
4  
5 package HTML::EP::CGIEncryptForm;
6 $HTML::EP::CGIEncryptForm::VERSION = '1.00';
7 @HTML::EP::CGIEncryptForm::ISA = 'HTML::EP';
8  
9 sub _handle {
10 my $self = shift; my $attr = shift;
11 return $self->{'_ep_cgiencryptform_handle'} if exists
12 $self->{'_ep_cgiencryptform_handle'};
13 my $cfo = $self->{'_ep_cgiencryptform_handle'} =
14 CGI::EncryptForm->new();
15 $cfo->secret_key($attr->{'secret_key'}) if exists $attr->{'secret_key'};
16 $cfo->usecharset($attr->{'usecharset'}) if exists $attr->{'usecharset'};
17 $cfo->charset($attr->{'charset'}) if exists $attr->{'charset'};
18 $cfo;
19 }
20  
21 sub _ep_cef_encrypt {
22 my($self, $attr) = @_;
23  
24 my $dest = $attr->{'dest'};
25 my $source = $attr->{'source'};
26 die "Missing attribute 'source' (Source Hash Reference Variable)"
27 unless defined $source;
28 $source = ref($source) ? $source :
29 ($source =~ /^(\w+)((?:\-\>\w+)+)$/) ?
30 $self->FindVar($1, $2) : $self->{$source};
31  
32 my $cfo = $self->_handle($attr);
33 my $output = $cfo->encrypt($source) || die $cfo->error();
34 if ($dest) {
35 $self->{$dest} = $output;
36 '';
37 } else {
38 $output;
39 }
40 }
41  
42 sub _ep_cef_decrypt {
43 my($self, $attr) = @_;
44  
45 my $dest = $attr->{'dest'};
46 my $source = $attr->{'source'};
47 die "Missing attribute 'source' (Source String Variable)"
48 unless defined $source;
49 $source = ref($source) ? $source :
50 ($source =~ /^(\w+)((?:\-\>\w+)+)$/) ?
51 $self->FindVar($1, $2) : $self->{$source};
52  
53 my $debug = $self->{'debug'};
54 my $cfo = $self->_handle($attr);
55  
56 my $output = $cfo->decrypt($source) || die $cfo->error();
57 if ($dest) {
58 $self->{$dest} = $output;
59 '';
60 } else {
61 $output;
62 }
63 }
64  
65  
66 __END__