blib/lib/HTML/FillInForm/Lite/Compat.pm

filter: Statementstmt 100% 41 / 41 Branchbran 93.7% 15 / 16 Conditioncond 96.1% 25 / 26 MC/DCmcdc 42.8% 6 / 14 Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 90.4% 95 / 105 CC 17 SCAR 24.8
CC
17
Cov
98%
fill
16.0
new
2.0
BEGIN
1.0
CRAP 12.0
↑ Summary blib/lib/HTML/FillInForm/Lite.pm »
1 package HTML::FillInForm::Lite::Compat;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 our $VERSION = '1.14';
7  
8 2 ▶use HTML::FillInForm::Lite;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 our @ISA = qw(HTML::FillInForm::Lite);
10  
11 2 ▶$INC{'HTML/FillInForm.pm'} ||= __FILE__;
Condition50%1/2
$INC{"HTML/FillInForm.pm"} ||= __FILE__
l!l
02
MC/DC0%0/1
$INC{"HTML/FillInForm.pm"} ||= __FILE__
$INC{"HTML/FillInForm.pm"}
Truth table50%1/2
A
A= $INC{"HTML/FillInForm.pm"}
Aresult
11
00
12 2 ▶push @HTML::FillInForm::ISA, __PACKAGE__
Branch: 1 branch
BranchTrueFalseTotal
unless "HTML::FillInForm"->isa(__PACKAGE__) 2 0 2
13 unless HTML::FillInForm->isa(__PACKAGE__);
14  
15 2 my %known_keys = (
16 scalarref => 1,
17 arrayref => 1,
18 fdat => 1,
19 fobject => 1,
20 file => 1,
21 target => 1,
22 fill_password => 1,
23 ignore_fields => 1,
24 disable_fields => 1,
25 );
26  
27 2 my %extended_keys = (
28 escape => 1,
29 decode_entity => 1,
30 layer => 1,
31 );
32  
33 2 @known_keys{keys %extended_keys} = ();
34  
35 BEGIN{
36 2 ▶ *fill_file = \&fill;
Subroutine BEGIN: called CC=1 SCAR=0.0
37 2 *fill_arrayref = \&fill;
38 2 *fill_scalarref = \&fill;
39 }
40  
41 sub new{
42 13 ▶ my $class = shift;
Subroutine new: called CC=2 SCAR=6.9
Pod documented
43  
44 13 ▶ if(@_){
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 1 12 13
45 1 warnings::warnif(portable =>
46 qq{$class->new() accepts no options, }
47 . q{use HTML::FillInForm::Lite->new(...) instead});
48 }
49  
50 12 return $class->SUPER::new();
51 }
52  
53 sub fill{
54 29 ▶ my $self = shift;
Subroutine fill: called CC=16 SCAR=27.7
Pod documented
55  
56 29 my $source;
57 my $data;
58  
59 29 ▶ if (defined $_[0] and not exists $known_keys{ $_[0] }){
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[0] and not exists $known_keys{$_[0]}) 15 14 29
Condition100%3/3
defined $_[0] and not exists $known_keys{$_[0]}
!ll&&!rl&&r
11315
MC/DC100%2/2
defined $_[0] and not exists $known_keys{$_[0]}
defined $_[0] not exists $known_keys{$_[0]}
Truth table100%3/3
A and not(B)
A= defined $_[0]B= not exists $known_keys{$_[0]}
ABresult
0X0
100
111
60 15 $source = shift;
61 }
62  
63 29 ▶ if (defined $_[0] and not exists $known_keys{ $_[0] }){
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[0] and not exists $known_keys{$_[0]}) 10 19 29
Condition100%3/3
defined $_[0] and not exists $known_keys{$_[0]}
!ll&&!rl&&r
11810
MC/DC100%2/2
defined $_[0] and not exists $known_keys{$_[0]}
defined $_[0] not exists $known_keys{$_[0]}
Truth table100%3/3
A and not(B)
A= defined $_[0]B= not exists $known_keys{$_[0]}
ABresult
0X0
100
111
64 10 $data = shift;
65 }
66  
67 29 my %option = @_;
68  
69 29 foreach my $key(keys %option){
70 32 ▶ if(exists $extended_keys{$key}){
Branch: 1 branch
BranchTrueFalseTotal
if (exists $extended_keys{$key}) 2 30 32
71 2 warnings::warnif(portable => qq{HTML::FillInForm::Lite-specific option "$key" supplied});
72 }
73 }
74  
75 28 ▶ $source ||= $option{file} || $option{scalarref} || $option{arrayref};
Condition100%9/9
$source ||= $option{"file"} || $option{"scalarref"} || $option{"arrayref"}
l!l&&r!l&&!r
15112
$option{'file'} || $option{'scalarref'} || $option{'arrayref'}
l!l&&r!l&&!r
1012
$option{"file"} or $option{"scalarref"}
l!l&&r!l&&!r
193
MC/DC0%0/4
$source ||= $option{"file"} || $option{"scalarref"} || $option{"arrayref"}
$source $option{"file"} $option{"scalarref"} $option{'arrayref'}
Truth table0%0/5
A ||= B or C || D
A= $sourceB= $option{"file"}C= $option{"scalarref"}D= $option{'arrayref'}
ABCDresult
1XXX1
01XX1
001X1
00011
00000
76 28 ▶ $data ||= $option{fdat} || $option{fobject};
Condition100%6/6
$data ||= $option{"fdat"} || $option{"fobject"}
l!l&&r!l&&!r
10162
$option{'fdat'} || $option{'fobject'}
l!l&&r!l&&!r
1332
MC/DC0%0/3
$data ||= $option{"fdat"} || $option{"fobject"}
$data $option{'fdat'} $option{'fobject'}
Truth table0%0/4
A ||= B || C
A= $dataB= $option{'fdat'}C= $option{'fobject'}
ABCresult
1XX1
01X1
0011
0000
77  
78 # ensure to delete all sources and data
79 28 delete @option{qw(scalarref arrayref file fdat fobject)};
80  
81 $option{fill_password} = 1
82 28 ▶ unless defined $option{fill_password};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $option{"fill_password"} 27 1 28
83 $option{decode_entity} = 1
84 28 ▶ unless defined $option{decode_entity};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $option{"decode_entity"} 27 1 28
85  
86 $option{ignore_fields} = [ $option{ignore_fields} ]
87 if defined $option{ignore_fields}
88 28 ▶ and ref $option{ignore_fields} ne 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
if defined $option{"ignore_fields"} and ref $option{"ignore_fields"} ne "ARRAY" 1 27 28
Condition100%3/3
defined $option{"ignore_fields"} and ref $option{"ignore_fields"} ne "ARRAY"
!ll&&!rl&&r
2611
MC/DC100%2/2
defined $option{"ignore_fields"} and ref $option{"ignore_fields"} ne "ARRAY"
defined $option{"ignore_fields"} ref $option{"ignore_fields"} ne "ARRAY"
Truth table100%3/3
A and B
A= defined $option{"ignore_fields"}B= ref $option{"ignore_fields"} ne "ARRAY"
ABresult
0X0
100
111
89  
90 28 return $self->SUPER::fill($source, $data, %option);
91 }
92  
93 2 1;
94  
95 __END__
↑ Summary blib/lib/HTML/FillInForm/Lite.pm »