Encode.pm

filter: Statementstmt 100% 28 / 28 Branchbran 50.0% 3 / 6 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 84.7% 39 / 46 CC 5 SCAR 8.3
CC
5
Cov
86%
_load
3.2
new
3.1
BEGIN
1.0
CRAP 2.3
« Encode/Guess.pm ↑ Summary
1 package Template::Provider::Encode;
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 2 ▶use base qw(Template::Provider);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use Encode;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 our $VERSION = '0.02';
9 2 our $INPUT_ENCODING;
10 2 our $OUTPUT_ENCODING;
11  
12 1 ▶sub new {
Subroutine new: called CC=3 SCAR=11.2
Pod documented
13 1 my $class = shift;
14 1 my $options = shift;
15  
16 1 ▶ $INPUT_ENCODING = exists $options->{ie} ? $options->{ie} : undef;
Branch: 1 branch
BranchTrueFalseTotal
exists $options->{'ie'} ? : 1 0 1
17 1 ▶ $OUTPUT_ENCODING = exists $options->{oe} ? $options->{oe} : undef;
Branch: 1 branch
BranchTrueFalseTotal
exists $options->{'oe'} ? : 1 0 1
18 1 delete $options->{ie};
19 1 delete $options->{oe};
20  
21 1 return $class->SUPER::new($options);
22 }
23  
24 1 ▶sub _load {
Subroutine _load: called CC=3 SCAR=11.8
25 1 my $self = shift;
26 1 my ($data, $error) = $self->SUPER::_load(@_);
27  
28 1 ▶ if ($INPUT_ENCODING and $OUTPUT_ENCODING) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Template::Provider::Encode::INPUT_ENCODING and $Template::Provider::Encode::OUTPUT_ENCODING) 1 0 1
Condition33%1/3
$Template::Provider::Encode::INPUT_ENCODING and $Template::Provider::Encode::OUTPUT_ENCODING
!ll&&!rl&&r
001
MC/DC0%0/2
$Template::Provider::Encode::INPUT_ENCODING and $Template::Provider::Encode::OUTPUT_ENCODING
$Template::Provider::Encode::INPUT_ENCODING $Template::Provider::Encode::OUTPUT_ENCODING
Truth table33%1/3
A and B
A= $Template::Provider::Encode::INPUT_ENCODINGB= $Template::Provider::Encode::OUTPUT_ENCODING
ABresult
0X0
100
111
29 1 Encode::from_to($data->{text}, $INPUT_ENCODING, $OUTPUT_ENCODING );
30 }
31  
32 1 return ($data, $error);
33 }
34  
35 2 1;
36 __END__
« Encode/Guess.pm ↑ Summary