blib/lib/YAML/Conditional.pm

filter: Statementstmt 85.1% 23 / 27 Branchbran 40.0% 4 / 10 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 70.0% 7 / 10 Podpod 80.0% 4 / 5 totaltotal 68.4% 39 / 57 CC 7 SCAR 12.4
CC
7
Cov
70%
compile
6.4
decode
4.1
encode
2.0
CRAP 3.5
↑ Summary
1 package YAML::Conditional;
2 14 ▶use 5.006; use strict; use warnings; our $VERSION = '1.03';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
3 14 ▶use YAML::XS qw/Dump DumpFile Load LoadFile/; use base 'Struct::Conditional';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 0 ▶sub encode {
Subroutine encode: not called CC=1 SCAR=6.9
Pod documented
6 0 Dump($_[1]);
7 }
8  
9 0 ▶sub encode_file {
Subroutine encode_file: not called CC=1 SCAR=6.9
Pod undocumented
10 0 DumpFile($_[1], $_[2]);
11 }
12  
13 15 ▶sub decode {
Subroutine decode: called CC=3 SCAR=14.2
Pod documented
14 15 ▶ if ($_[1] !~ m/\n/ && -f $_[1]) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $_[1] =~ /\n/ and -f $_[1]) 0 15 15
Condition33%1/3
not $_[1] =~ /\n/ and -f $_[1]
!ll&&!rl&&r
1500
MC/DC0%0/2
not $_[1] =~ /\n/ and -f $_[1]
not $_[1] =~ /\n/ -f $_[1]
Truth table33%1/3
not(A) and B
A= not $_[1] =~ /\n/B= -f $_[1]
ABresult
0X0
100
111
15 0 return $_[0]->decode_file($_[1]);
16 }
17 15 Load($_[1]);
18 }
19  
20 0 ▶sub decode_file {
Subroutine decode_file: not called CC=1 SCAR=6.9
Pod documented
21 0 LoadFile($_[1], $_[2]);
22 }
23  
24 15 ▶sub compile {
Subroutine compile: called CC=5 SCAR=18.6
Pod documented
25 15 my ($self, $yaml, $params, $return_struct, $out_file) = @_;
26 15 ▶ $yaml = $self->decode($yaml) unless ref $yaml;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $yaml 15 0 15
27 15 ▶ $params = $self->decode($params) unless ref $params;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $params 0 15 15
28 15 $yaml = $self->SUPER::compile($yaml, $params);
29 15 ▶ return $return_struct
Branch: 2 branches
BranchTrueFalseTotal
$return_struct ? : 15 0 15
$out_file ? : 0 0 0
30 ? $yaml
31 : $out_file
32 ? $self->encode_file($out_file, $yaml)
33 : $self->encode($yaml);
34 }
35  
36 14 1;
37  
38 __END__
↑ Summary