blib/lib/Hades/Macro/YAML.pm

filter: Statementstmt 72.8% 268 / 368 Branchbran 45.4% 199 / 438 Conditioncond 59.5% 109 / 183 MC/DCmcdc 39.3% 37 / 94 Subroutinesub 100% 22 / 22 Podpod 100% 6 / 6 totaltotal 57.7% 641 / 1111 SCAR 87.9
CC
293
Cov
58%
_yaml_write_file_YAML
51.2
_yaml_write_file_YAML_XS
51.2
_yaml_write_file_YAML_PP
51.2
CRAP 6544.7
↑ Summary
1 package Hades::Macro::YAML;
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 2 ▶use base qw/Hades::Macro/;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 our $VERSION = 0.02;
6 2 our ( $YAML_CLASS, $CLASS_LOADED );
7  
8 BEGIN {
9 $YAML_CLASS = eval {
10 2 require YAML::XS;
11 0 'YAML::XS';
12 } || eval {
13 2 require YAML::PP;
14 2 'YAML::PP';
15 2 ▶ } || eval {
Subroutine BEGIN: called CC=4 SCAR=19.7
Condition33%2/6
eval { || eval {
l!l&&r!l&&!r
200
eval { or eval {
l!l&&r!l&&!r
020
MC/DC0%0/3
eval { do { require YAML::XS; 'YAML::XS' } } || eval { do { require YAML::PP; 'YAML::PP' } } || eval { do { require YAML; 'YAML' } }
eval { do { require YAML::XS; "YAML::XS" } } eval { do { require YAML::PP; "YAML::PP" } } eval { do { require YAML; 'YAML' } }
Truth table25%1/4
A or B || C
A= eval { do { require YAML::XS; "YAML::XS" } }B= eval { do { require YAML::PP; "YAML::PP" } }C= eval { do { require YAML; 'YAML' } }
ABCresult
1XX1
01X1
0011
0000
16 0 require YAML;
17 0 'YAML';
18 };
19 2 ▶ die
Branch: 1 branch
BranchTrueFalseTotal
unless $YAML_CLASS 0 2 2
20 'No supported YAML module installed - supported modules are YAML::XS, YAML::PP or YAML'
21 unless $YAML_CLASS;
22 }
23  
24 sub new {
25 24 ▶ my ( $cls, %args ) = ( shift(), scalar @_ == 1 ? %{ $_[0] } : @_ );
Subroutine new: called CC=7 SCAR=20.4
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
scalar @_ == 1 ? : 22 2 24
26 24 my $self = $cls->SUPER::new(%args);
27 22 my %accessors = (
28 macro => {
29 default => [
30 qw/
31 yaml_load_string
32 yaml_load_file
33 yaml_write_string
34 yaml_write_file
35 /
36 ],
37 },
38 );
39 22 for my $accessor ( keys %accessors ) {
40 my $param
41 = defined $args{$accessor}
42 ? $args{$accessor}
43 22 ▶ : $accessors{$accessor}->{default};
Branch: 1 branch
BranchTrueFalseTotal
defined $args{$accessor} ? : 1 21 22
44 my $value
45 = $self->$accessor( $accessors{$accessor}->{builder}
46 22 ▶ ? $accessors{$accessor}->{builder}->( $self, $param )
Branch: 1 branch
BranchTrueFalseTotal
$accessors{$accessor}{'builder'} ? : 0 22 22
47 : $param );
48 22 ▶ unless ( !$accessors{$accessor}->{required} || defined $value ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (not $accessors{$accessor}{"required"} or defined $value) 0 22 22
Condition33%1/3
not $accessors{$accessor}{"required"} or defined $value
l!l&&r!l&&!r
2200
MC/DC0%0/2
not $accessors{$accessor}{"required"} or defined $value
not $accessors{$accessor}{"required"} defined $value
Truth table33%1/3
not(A) or B
A= not $accessors{$accessor}{"required"}B= defined $value
ABresult
1X1
011
000
49 0 die "$accessor accessor is required";
50 }
51 }
52 22 return $self;
53 }
54  
55 sub macro {
56 51 ▶ my ( $self, $value ) = @_;
Subroutine macro: called CC=4 SCAR=13.9
Pod documented
57 51 ▶ if ( defined $value ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 49 2 51
58 49 ▶ if ( ( ref($value) || "" ) ne "ARRAY" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $value || "") ne "ARRAY") 4 45 49
Condition100%2/2
ref $value || ''
l!l
472
MC/DC100%1/1
ref $value || ''
ref $value
Truth table100%2/2
A
A= ref $value
Aresult
11
00
59 4 die qq{ArrayRef: invalid value $value for accessor macro};
60 }
61 45 $self->{macro} = $value;
62 }
63 47 return $self->{macro};
64 }
65  
66 sub yaml_load_string {
67 8 ▶ my ( $self, $mg, $str, $param, $list ) = @_;
Subroutine yaml_load_string: called CC=17 SCAR=36.7
Pod documented
68 8 ▶ if ( ( ref($mg) || "" ) =~ m/^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $mg || "") =~ /^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/) 2 6 8
Condition100%2/2
ref $mg || ''
l!l
71
MC/DC100%1/1
ref $mg || ''
ref $mg
Truth table100%2/2
A
A= ref $mg
Aresult
11
00
69 2 ▶ $mg = defined $mg ? $mg : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $mg ? : 2 0 2
70 2 die
71 qq{Object: invalid value $mg for variable \$mg in method yaml_load_string};
72 }
73 6 ▶ if ( !defined($str) || ref $str ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $str or ref $str) 2 4 6
Condition66%2/3
not defined $str or ref $str
l!l&&r!l&&!r
024
MC/DC50%1/2
not defined $str or ref $str
not defined $str ref $str
Truth table66%2/3
not(A) or B
A= not defined $strB= ref $str
ABresult
1X1
011
000
74 2 ▶ $str = defined $str ? $str : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $str ? : 2 0 2
75 2 die
76 qq{Str: invalid value $str for variable \$str in method yaml_load_string};
77 }
78 4 ▶ if ( defined $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $param) 2 2 4
79 2 ▶ if ( ref $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $param) 2 0 2
80 2 die
81 qq{Optional[Str]: invalid value $param for variable \$param in method yaml_load_string};
82 }
83 }
84 2 ▶ if ( defined $list ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $list) 2 0 2
85 2 my $ref = ref $list;
86 2 ▶ if ( ( $ref || 'SCALAR' ) ne 'SCALAR'
Branch: 2 branches
BranchTrueFalseTotal
if (($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/) 2 0 2
$ref ? : 0 0 0
Condition40%2/5
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
l!l&&r!l&&!r
200
$ref || 'SCALAR'
l!l
20
MC/DC0%0/2
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
$ref not +($ref ? $$list : $list) =~ /^(1|0)$/
Truth table33%1/3
A or not(B)
A= $refB= not +($ref ? $$list : $list) =~ /^(1|0)$/
ABresult
1X1
011
000
87 || ( $ref ? $$list : $list ) !~ m/^(1|0)$/ )
88 {
89 2 die
90 qq{Optional[Bool]: invalid value $list for variable \$list in method yaml_load_string};
91 }
92 0 ▶ $list = !!( $ref ? $$list : $list ) ? 1 : 0;
Branch: 2 branches
BranchTrueFalseTotal
!!($ref ? $$list : $list) ? : 0 0 0
$ref ? : 0 0 0
93 }
94  
95 0 ▶ unless ($CLASS_LOADED) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($CLASS_LOADED) 0 0 0
96 0 $mg->use($YAML_CLASS);
97 }
98 0 ( my $uf = $YAML_CLASS ) =~ s/\:\:/_/g;
99 0 my $cb = "_yaml_load_string_$uf";
100 0 return __PACKAGE__->$cb( $mg, $str, $param, $list );
101  
102 }
103  
104 sub _yaml_load_string_YAML {
105 8 ▶ my ( $self, $mg, $str, $param, $list ) = @_;
Subroutine _yaml_load_string_YAML: called CC=18 SCAR=38.5
106 8 ▶ if ( ( ref($mg) || "" ) =~ m/^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $mg || "") =~ /^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/) 2 6 8
Condition100%2/2
ref $mg || ''
l!l
71
MC/DC100%1/1
ref $mg || ''
ref $mg
Truth table100%2/2
A
A= ref $mg
Aresult
11
00
107 2 ▶ $mg = defined $mg ? $mg : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $mg ? : 2 0 2
108 2 die
109 qq{Object: invalid value $mg for variable \$mg in method _yaml_load_string_YAML};
110 }
111 6 ▶ if ( !defined($str) || ref $str ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $str or ref $str) 2 4 6
Condition66%2/3
not defined $str or ref $str
l!l&&r!l&&!r
024
MC/DC50%1/2
not defined $str or ref $str
not defined $str ref $str
Truth table66%2/3
not(A) or B
A= not defined $strB= ref $str
ABresult
1X1
011
000
112 2 ▶ $str = defined $str ? $str : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $str ? : 2 0 2
113 2 die
114 qq{Str: invalid value $str for variable \$str in method _yaml_load_string_YAML};
115 }
116 4 ▶ if ( defined $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $param) 2 2 4
117 2 ▶ if ( ref $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $param) 2 0 2
118 2 die
119 qq{Optional[Str]: invalid value $param for variable \$param in method _yaml_load_string_YAML};
120 }
121 }
122 2 ▶ if ( defined $list ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $list) 2 0 2
123 2 my $ref = ref $list;
124 2 ▶ if ( ( $ref || 'SCALAR' ) ne 'SCALAR'
Branch: 2 branches
BranchTrueFalseTotal
if (($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/) 2 0 2
$ref ? : 0 0 0
Condition40%2/5
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
l!l&&r!l&&!r
200
$ref || 'SCALAR'
l!l
20
MC/DC0%0/2
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
$ref not +($ref ? $$list : $list) =~ /^(1|0)$/
Truth table33%1/3
A or not(B)
A= $refB= not +($ref ? $$list : $list) =~ /^(1|0)$/
ABresult
1X1
011
000
125 || ( $ref ? $$list : $list ) !~ m/^(1|0)$/ )
126 {
127 2 die
128 qq{Optional[Bool]: invalid value $list for variable \$list in method _yaml_load_string_YAML};
129 }
130 0 ▶ $list = !!( $ref ? $$list : $list ) ? 1 : 0;
Branch: 2 branches
BranchTrueFalseTotal
!!($ref ? $$list : $list) ? : 0 0 0
$ref ? : 0 0 0
131 }
132  
133 0 my $code = q||;
134 0 ▶ $code .= qq|$param = | if $param;
Branch: 1 branch
BranchTrueFalseTotal
if $param 0 0 0
135 0 $code .= qq|YAML::Load($str)|;
136 0 ▶ $code .= $list ? q|,| : q|;|;
Branch: 1 branch
BranchTrueFalseTotal
$list ? : 0 0 0
137 0 return $code;
138  
139 }
140  
141 sub _yaml_load_string_YAML_XS {
142 8 ▶ my ( $self, $mg, $str, $param, $list ) = @_;
Subroutine _yaml_load_string_YAML_XS: called CC=18 SCAR=38.5
143 8 ▶ if ( ( ref($mg) || "" ) =~ m/^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $mg || "") =~ /^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/) 2 6 8
Condition100%2/2
ref $mg || ''
l!l
71
MC/DC100%1/1
ref $mg || ''
ref $mg
Truth table100%2/2
A
A= ref $mg
Aresult
11
00
144 2 ▶ $mg = defined $mg ? $mg : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $mg ? : 2 0 2
145 2 die
146 qq{Object: invalid value $mg for variable \$mg in method _yaml_load_string_YAML_XS};
147 }
148 6 ▶ if ( !defined($str) || ref $str ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $str or ref $str) 2 4 6
Condition66%2/3
not defined $str or ref $str
l!l&&r!l&&!r
024
MC/DC50%1/2
not defined $str or ref $str
not defined $str ref $str
Truth table66%2/3
not(A) or B
A= not defined $strB= ref $str
ABresult
1X1
011
000
149 2 ▶ $str = defined $str ? $str : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $str ? : 2 0 2
150 2 die
151 qq{Str: invalid value $str for variable \$str in method _yaml_load_string_YAML_XS};
152 }
153 4 ▶ if ( defined $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $param) 2 2 4
154 2 ▶ if ( ref $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $param) 2 0 2
155 2 die
156 qq{Optional[Str]: invalid value $param for variable \$param in method _yaml_load_string_YAML_XS};
157 }
158 }
159 2 ▶ if ( defined $list ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $list) 2 0 2
160 2 my $ref = ref $list;
161 2 ▶ if ( ( $ref || 'SCALAR' ) ne 'SCALAR'
Branch: 2 branches
BranchTrueFalseTotal
if (($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/) 2 0 2
$ref ? : 0 0 0
Condition40%2/5
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
l!l&&r!l&&!r
200
$ref || 'SCALAR'
l!l
20
MC/DC0%0/2
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
$ref not +($ref ? $$list : $list) =~ /^(1|0)$/
Truth table33%1/3
A or not(B)
A= $refB= not +($ref ? $$list : $list) =~ /^(1|0)$/
ABresult
1X1
011
000
162 || ( $ref ? $$list : $list ) !~ m/^(1|0)$/ )
163 {
164 2 die
165 qq{Optional[Bool]: invalid value $list for variable \$list in method _yaml_load_string_YAML_XS};
166 }
167 0 ▶ $list = !!( $ref ? $$list : $list ) ? 1 : 0;
Branch: 2 branches
BranchTrueFalseTotal
!!($ref ? $$list : $list) ? : 0 0 0
$ref ? : 0 0 0
168 }
169  
170 0 my $code = q||;
171 0 ▶ $code .= qq|$param = | if $param;
Branch: 1 branch
BranchTrueFalseTotal
if $param 0 0 0
172 0 $code .= qq|Load($str)|;
173 0 ▶ $code .= $list ? q|,| : q|;|;
Branch: 1 branch
BranchTrueFalseTotal
$list ? : 0 0 0
174 0 return $code;
175  
176 }
177  
178 sub _yaml_load_string_YAML_PP {
179 8 ▶ my ( $self, $mg, $str, $param, $list ) = @_;
Subroutine _yaml_load_string_YAML_PP: called CC=18 SCAR=38.5
180 8 ▶ if ( ( ref($mg) || "" ) =~ m/^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $mg || "") =~ /^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/) 2 6 8
Condition100%2/2
ref $mg || ''
l!l
71
MC/DC100%1/1
ref $mg || ''
ref $mg
Truth table100%2/2
A
A= ref $mg
Aresult
11
00
181 2 ▶ $mg = defined $mg ? $mg : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $mg ? : 2 0 2
182 2 die
183 qq{Object: invalid value $mg for variable \$mg in method _yaml_load_string_YAML_PP};
184 }
185 6 ▶ if ( !defined($str) || ref $str ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $str or ref $str) 2 4 6
Condition66%2/3
not defined $str or ref $str
l!l&&r!l&&!r
024
MC/DC50%1/2
not defined $str or ref $str
not defined $str ref $str
Truth table66%2/3
not(A) or B
A= not defined $strB= ref $str
ABresult
1X1
011
000
186 2 ▶ $str = defined $str ? $str : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $str ? : 2 0 2
187 2 die
188 qq{Str: invalid value $str for variable \$str in method _yaml_load_string_YAML_PP};
189 }
190 4 ▶ if ( defined $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $param) 2 2 4
191 2 ▶ if ( ref $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $param) 2 0 2
192 2 die
193 qq{Optional[Str]: invalid value $param for variable \$param in method _yaml_load_string_YAML_PP};
194 }
195 }
196 2 ▶ if ( defined $list ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $list) 2 0 2
197 2 my $ref = ref $list;
198 2 ▶ if ( ( $ref || 'SCALAR' ) ne 'SCALAR'
Branch: 2 branches
BranchTrueFalseTotal
if (($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/) 2 0 2
$ref ? : 0 0 0
Condition40%2/5
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
l!l&&r!l&&!r
200
$ref || 'SCALAR'
l!l
20
MC/DC0%0/2
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
$ref not +($ref ? $$list : $list) =~ /^(1|0)$/
Truth table33%1/3
A or not(B)
A= $refB= not +($ref ? $$list : $list) =~ /^(1|0)$/
ABresult
1X1
011
000
199 || ( $ref ? $$list : $list ) !~ m/^(1|0)$/ )
200 {
201 2 die
202 qq{Optional[Bool]: invalid value $list for variable \$list in method _yaml_load_string_YAML_PP};
203 }
204 0 ▶ $list = !!( $ref ? $$list : $list ) ? 1 : 0;
Branch: 2 branches
BranchTrueFalseTotal
!!($ref ? $$list : $list) ? : 0 0 0
$ref ? : 0 0 0
205 }
206  
207 0 my $code = q|my $lpp = YAML::PP->new;|;
208 0 ▶ $code .= qq|$param = | if $param;
Branch: 1 branch
BranchTrueFalseTotal
if $param 0 0 0
209 0 $code .= qq|\$lpp->load_string($str);|;
210 0 ▶ $code = $list ? qq|do { $code },| : qq|$code;|;
Branch: 1 branch
BranchTrueFalseTotal
$list ? : 0 0 0
211 0 return $code;
212  
213 }
214  
215 sub yaml_load_file {
216 8 ▶ my ( $self, $mg, $file, $param, $list ) = @_;
Subroutine yaml_load_file: called CC=17 SCAR=36.7
Pod documented
217 8 ▶ if ( ( ref($mg) || "" ) =~ m/^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $mg || "") =~ /^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/) 2 6 8
Condition100%2/2
ref $mg || ''
l!l
71
MC/DC100%1/1
ref $mg || ''
ref $mg
Truth table100%2/2
A
A= ref $mg
Aresult
11
00
218 2 ▶ $mg = defined $mg ? $mg : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $mg ? : 2 0 2
219 2 die
220 qq{Object: invalid value $mg for variable \$mg in method yaml_load_file};
221 }
222 6 ▶ if ( !defined($file) || ref $file ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $file or ref $file) 2 4 6
Condition66%2/3
not defined $file or ref $file
l!l&&r!l&&!r
024
MC/DC50%1/2
not defined $file or ref $file
not defined $file ref $file
Truth table66%2/3
not(A) or B
A= not defined $fileB= ref $file
ABresult
1X1
011
000
223 2 ▶ $file = defined $file ? $file : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $file ? : 2 0 2
224 2 die
225 qq{Str: invalid value $file for variable \$file in method yaml_load_file};
226 }
227 4 ▶ if ( defined $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $param) 2 2 4
228 2 ▶ if ( ref $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $param) 2 0 2
229 2 die
230 qq{Optional[Str]: invalid value $param for variable \$param in method yaml_load_file};
231 }
232 }
233 2 ▶ if ( defined $list ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $list) 2 0 2
234 2 my $ref = ref $list;
235 2 ▶ if ( ( $ref || 'SCALAR' ) ne 'SCALAR'
Branch: 2 branches
BranchTrueFalseTotal
if (($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/) 2 0 2
$ref ? : 0 0 0
Condition40%2/5
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
l!l&&r!l&&!r
200
$ref || 'SCALAR'
l!l
20
MC/DC0%0/2
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
$ref not +($ref ? $$list : $list) =~ /^(1|0)$/
Truth table33%1/3
A or not(B)
A= $refB= not +($ref ? $$list : $list) =~ /^(1|0)$/
ABresult
1X1
011
000
236 || ( $ref ? $$list : $list ) !~ m/^(1|0)$/ )
237 {
238 2 die
239 qq{Optional[Bool]: invalid value $list for variable \$list in method yaml_load_file};
240 }
241 0 ▶ $list = !!( $ref ? $$list : $list ) ? 1 : 0;
Branch: 2 branches
BranchTrueFalseTotal
!!($ref ? $$list : $list) ? : 0 0 0
$ref ? : 0 0 0
242 }
243  
244 0 ▶ unless ($CLASS_LOADED) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($CLASS_LOADED) 0 0 0
245 0 $mg->use($YAML_CLASS);
246 }
247 0 ( my $uf = $YAML_CLASS ) =~ s/\:\:/_/g;
248 0 my $cb = "_yaml_load_file_$uf";
249 0 return __PACKAGE__->$cb( $mg, $file, $param, $list );
250  
251 }
252  
253 sub _yaml_load_file_YAML {
254 8 ▶ my ( $self, $mg, $file, $param, $list ) = @_;
Subroutine _yaml_load_file_YAML: called CC=18 SCAR=38.5
255 8 ▶ if ( ( ref($mg) || "" ) =~ m/^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $mg || "") =~ /^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/) 2 6 8
Condition100%2/2
ref $mg || ''
l!l
71
MC/DC100%1/1
ref $mg || ''
ref $mg
Truth table100%2/2
A
A= ref $mg
Aresult
11
00
256 2 ▶ $mg = defined $mg ? $mg : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $mg ? : 2 0 2
257 2 die
258 qq{Object: invalid value $mg for variable \$mg in method _yaml_load_file_YAML};
259 }
260 6 ▶ if ( !defined($file) || ref $file ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $file or ref $file) 2 4 6
Condition66%2/3
not defined $file or ref $file
l!l&&r!l&&!r
024
MC/DC50%1/2
not defined $file or ref $file
not defined $file ref $file
Truth table66%2/3
not(A) or B
A= not defined $fileB= ref $file
ABresult
1X1
011
000
261 2 ▶ $file = defined $file ? $file : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $file ? : 2 0 2
262 2 die
263 qq{Str: invalid value $file for variable \$file in method _yaml_load_file_YAML};
264 }
265 4 ▶ if ( defined $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $param) 2 2 4
266 2 ▶ if ( ref $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $param) 2 0 2
267 2 die
268 qq{Optional[Str]: invalid value $param for variable \$param in method _yaml_load_file_YAML};
269 }
270 }
271 2 ▶ if ( defined $list ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $list) 2 0 2
272 2 my $ref = ref $list;
273 2 ▶ if ( ( $ref || 'SCALAR' ) ne 'SCALAR'
Branch: 2 branches
BranchTrueFalseTotal
if (($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/) 2 0 2
$ref ? : 0 0 0
Condition40%2/5
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
l!l&&r!l&&!r
200
$ref || 'SCALAR'
l!l
20
MC/DC0%0/2
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
$ref not +($ref ? $$list : $list) =~ /^(1|0)$/
Truth table33%1/3
A or not(B)
A= $refB= not +($ref ? $$list : $list) =~ /^(1|0)$/
ABresult
1X1
011
000
274 || ( $ref ? $$list : $list ) !~ m/^(1|0)$/ )
275 {
276 2 die
277 qq{Optional[Bool]: invalid value $list for variable \$list in method _yaml_load_file_YAML};
278 }
279 0 ▶ $list = !!( $ref ? $$list : $list ) ? 1 : 0;
Branch: 2 branches
BranchTrueFalseTotal
!!($ref ? $$list : $list) ? : 0 0 0
$ref ? : 0 0 0
280 }
281  
282 0 my $code = q||;
283 0 ▶ $code .= qq|$param = | if $param;
Branch: 1 branch
BranchTrueFalseTotal
if $param 0 0 0
284 0 $code .= qq|YAML::LoadFile($file)|;
285 0 ▶ $code .= $list ? q|,| : q|;|;
Branch: 1 branch
BranchTrueFalseTotal
$list ? : 0 0 0
286 0 return $code;
287  
288 }
289  
290 sub _yaml_load_file_YAML_XS {
291 8 ▶ my ( $self, $mg, $file, $param, $list ) = @_;
Subroutine _yaml_load_file_YAML_XS: called CC=18 SCAR=38.5
292 8 ▶ if ( ( ref($mg) || "" ) =~ m/^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $mg || "") =~ /^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/) 2 6 8
Condition100%2/2
ref $mg || ''
l!l
71
MC/DC100%1/1
ref $mg || ''
ref $mg
Truth table100%2/2
A
A= ref $mg
Aresult
11
00
293 2 ▶ $mg = defined $mg ? $mg : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $mg ? : 2 0 2
294 2 die
295 qq{Object: invalid value $mg for variable \$mg in method _yaml_load_file_YAML_XS};
296 }
297 6 ▶ if ( !defined($file) || ref $file ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $file or ref $file) 2 4 6
Condition66%2/3
not defined $file or ref $file
l!l&&r!l&&!r
024
MC/DC50%1/2
not defined $file or ref $file
not defined $file ref $file
Truth table66%2/3
not(A) or B
A= not defined $fileB= ref $file
ABresult
1X1
011
000
298 2 ▶ $file = defined $file ? $file : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $file ? : 2 0 2
299 2 die
300 qq{Str: invalid value $file for variable \$file in method _yaml_load_file_YAML_XS};
301 }
302 4 ▶ if ( defined $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $param) 2 2 4
303 2 ▶ if ( ref $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $param) 2 0 2
304 2 die
305 qq{Optional[Str]: invalid value $param for variable \$param in method _yaml_load_file_YAML_XS};
306 }
307 }
308 2 ▶ if ( defined $list ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $list) 2 0 2
309 2 my $ref = ref $list;
310 2 ▶ if ( ( $ref || 'SCALAR' ) ne 'SCALAR'
Branch: 2 branches
BranchTrueFalseTotal
if (($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/) 2 0 2
$ref ? : 0 0 0
Condition40%2/5
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
l!l&&r!l&&!r
200
$ref || 'SCALAR'
l!l
20
MC/DC0%0/2
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
$ref not +($ref ? $$list : $list) =~ /^(1|0)$/
Truth table33%1/3
A or not(B)
A= $refB= not +($ref ? $$list : $list) =~ /^(1|0)$/
ABresult
1X1
011
000
311 || ( $ref ? $$list : $list ) !~ m/^(1|0)$/ )
312 {
313 2 die
314 qq{Optional[Bool]: invalid value $list for variable \$list in method _yaml_load_file_YAML_XS};
315 }
316 0 ▶ $list = !!( $ref ? $$list : $list ) ? 1 : 0;
Branch: 2 branches
BranchTrueFalseTotal
!!($ref ? $$list : $list) ? : 0 0 0
$ref ? : 0 0 0
317 }
318  
319 0 my $code = q||;
320 0 ▶ $code .= qq|$param = | if $param;
Branch: 1 branch
BranchTrueFalseTotal
if $param 0 0 0
321 0 $code .= qq|LoadFile($file)|;
322 0 ▶ $code .= $list ? q|,| : q|;|;
Branch: 1 branch
BranchTrueFalseTotal
$list ? : 0 0 0
323 0 return $code;
324  
325 }
326  
327 sub _yaml_load_file_YAML_PP {
328 8 ▶ my ( $self, $mg, $file, $param, $list ) = @_;
Subroutine _yaml_load_file_YAML_PP: called CC=18 SCAR=38.5
329 8 ▶ if ( ( ref($mg) || "" ) =~ m/^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $mg || "") =~ /^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/) 2 6 8
Condition100%2/2
ref $mg || ''
l!l
71
MC/DC100%1/1
ref $mg || ''
ref $mg
Truth table100%2/2
A
A= ref $mg
Aresult
11
00
330 2 ▶ $mg = defined $mg ? $mg : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $mg ? : 2 0 2
331 2 die
332 qq{Object: invalid value $mg for variable \$mg in method _yaml_load_file_YAML_PP};
333 }
334 6 ▶ if ( !defined($file) || ref $file ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $file or ref $file) 2 4 6
Condition66%2/3
not defined $file or ref $file
l!l&&r!l&&!r
024
MC/DC50%1/2
not defined $file or ref $file
not defined $file ref $file
Truth table66%2/3
not(A) or B
A= not defined $fileB= ref $file
ABresult
1X1
011
000
335 2 ▶ $file = defined $file ? $file : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $file ? : 2 0 2
336 2 die
337 qq{Str: invalid value $file for variable \$file in method _yaml_load_file_YAML_PP};
338 }
339 4 ▶ if ( defined $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $param) 2 2 4
340 2 ▶ if ( ref $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $param) 2 0 2
341 2 die
342 qq{Optional[Str]: invalid value $param for variable \$param in method _yaml_load_file_YAML_PP};
343 }
344 }
345 2 ▶ if ( defined $list ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $list) 2 0 2
346 2 my $ref = ref $list;
347 2 ▶ if ( ( $ref || 'SCALAR' ) ne 'SCALAR'
Branch: 2 branches
BranchTrueFalseTotal
if (($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/) 2 0 2
$ref ? : 0 0 0
Condition40%2/5
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
l!l&&r!l&&!r
200
$ref || 'SCALAR'
l!l
20
MC/DC0%0/2
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
$ref not +($ref ? $$list : $list) =~ /^(1|0)$/
Truth table33%1/3
A or not(B)
A= $refB= not +($ref ? $$list : $list) =~ /^(1|0)$/
ABresult
1X1
011
000
348 || ( $ref ? $$list : $list ) !~ m/^(1|0)$/ )
349 {
350 2 die
351 qq{Optional[Bool]: invalid value $list for variable \$list in method _yaml_load_file_YAML_PP};
352 }
353 0 ▶ $list = !!( $ref ? $$list : $list ) ? 1 : 0;
Branch: 2 branches
BranchTrueFalseTotal
!!($ref ? $$list : $list) ? : 0 0 0
$ref ? : 0 0 0
354 }
355  
356 0 my $code = q|my $lpp = YAML::PP->new;|;
357 0 ▶ $code .= qq|$param = | if $param;
Branch: 1 branch
BranchTrueFalseTotal
if $param 0 0 0
358 0 $code .= qq|\$lpp->load_file($file);|;
359 0 ▶ $code = $list ? qq|do { $code },| : qq|$code;|;
Branch: 1 branch
BranchTrueFalseTotal
$list ? : 0 0 0
360 0 return $code;
361  
362 }
363  
364 sub yaml_write_string {
365 8 ▶ my ( $self, $mg, $content, $param, $list ) = @_;
Subroutine yaml_write_string: called CC=17 SCAR=36.7
Pod documented
366 8 ▶ if ( ( ref($mg) || "" ) =~ m/^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $mg || "") =~ /^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/) 2 6 8
Condition100%2/2
ref $mg || ''
l!l
71
MC/DC100%1/1
ref $mg || ''
ref $mg
Truth table100%2/2
A
A= ref $mg
Aresult
11
00
367 2 ▶ $mg = defined $mg ? $mg : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $mg ? : 2 0 2
368 2 die
369 qq{Object: invalid value $mg for variable \$mg in method yaml_write_string};
370 }
371 6 ▶ if ( !defined($content) || ref $content ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $content or ref $content) 2 4 6
Condition66%2/3
not defined $content or ref $content
l!l&&r!l&&!r
024
MC/DC50%1/2
not defined $content or ref $content
not defined $content ref $content
Truth table66%2/3
not(A) or B
A= not defined $contentB= ref $content
ABresult
1X1
011
000
372 2 ▶ $content = defined $content ? $content : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $content ? : 2 0 2
373 2 die
374 qq{Str: invalid value $content for variable \$content in method yaml_write_string};
375 }
376 4 ▶ if ( defined $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $param) 2 2 4
377 2 ▶ if ( ref $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $param) 2 0 2
378 2 die
379 qq{Optional[Str]: invalid value $param for variable \$param in method yaml_write_string};
380 }
381 }
382 2 ▶ if ( defined $list ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $list) 2 0 2
383 2 my $ref = ref $list;
384 2 ▶ if ( ( $ref || 'SCALAR' ) ne 'SCALAR'
Branch: 2 branches
BranchTrueFalseTotal
if (($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/) 2 0 2
$ref ? : 0 0 0
Condition40%2/5
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
l!l&&r!l&&!r
200
$ref || 'SCALAR'
l!l
20
MC/DC0%0/2
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
$ref not +($ref ? $$list : $list) =~ /^(1|0)$/
Truth table33%1/3
A or not(B)
A= $refB= not +($ref ? $$list : $list) =~ /^(1|0)$/
ABresult
1X1
011
000
385 || ( $ref ? $$list : $list ) !~ m/^(1|0)$/ )
386 {
387 2 die
388 qq{Optional[Bool]: invalid value $list for variable \$list in method yaml_write_string};
389 }
390 0 ▶ $list = !!( $ref ? $$list : $list ) ? 1 : 0;
Branch: 2 branches
BranchTrueFalseTotal
!!($ref ? $$list : $list) ? : 0 0 0
$ref ? : 0 0 0
391 }
392  
393 0 ▶ unless ($CLASS_LOADED) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($CLASS_LOADED) 0 0 0
394 0 $mg->use($YAML_CLASS);
395 }
396 0 ( my $uf = $YAML_CLASS ) =~ s/\:\:/_/g;
397 0 my $cb = "_yaml_write_string_$uf";
398 0 return __PACKAGE__->$cb( $mg, $content, $param, $list );
399  
400 }
401  
402 sub _yaml_write_string_YAML {
403 8 ▶ my ( $self, $mg, $content, $param, $list ) = @_;
Subroutine _yaml_write_string_YAML: called CC=18 SCAR=38.5
404 8 ▶ if ( ( ref($mg) || "" ) =~ m/^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $mg || "") =~ /^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/) 2 6 8
Condition100%2/2
ref $mg || ''
l!l
71
MC/DC100%1/1
ref $mg || ''
ref $mg
Truth table100%2/2
A
A= ref $mg
Aresult
11
00
405 2 ▶ $mg = defined $mg ? $mg : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $mg ? : 2 0 2
406 2 die
407 qq{Object: invalid value $mg for variable \$mg in method _yaml_write_string_YAML};
408 }
409 6 ▶ if ( !defined($content) || ref $content ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $content or ref $content) 2 4 6
Condition66%2/3
not defined $content or ref $content
l!l&&r!l&&!r
024
MC/DC50%1/2
not defined $content or ref $content
not defined $content ref $content
Truth table66%2/3
not(A) or B
A= not defined $contentB= ref $content
ABresult
1X1
011
000
410 2 ▶ $content = defined $content ? $content : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $content ? : 2 0 2
411 2 die
412 qq{Str: invalid value $content for variable \$content in method _yaml_write_string_YAML};
413 }
414 4 ▶ if ( defined $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $param) 2 2 4
415 2 ▶ if ( ref $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $param) 2 0 2
416 2 die
417 qq{Optional[Str]: invalid value $param for variable \$param in method _yaml_write_string_YAML};
418 }
419 }
420 2 ▶ if ( defined $list ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $list) 2 0 2
421 2 my $ref = ref $list;
422 2 ▶ if ( ( $ref || 'SCALAR' ) ne 'SCALAR'
Branch: 2 branches
BranchTrueFalseTotal
if (($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/) 2 0 2
$ref ? : 0 0 0
Condition40%2/5
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
l!l&&r!l&&!r
200
$ref || 'SCALAR'
l!l
20
MC/DC0%0/2
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
$ref not +($ref ? $$list : $list) =~ /^(1|0)$/
Truth table33%1/3
A or not(B)
A= $refB= not +($ref ? $$list : $list) =~ /^(1|0)$/
ABresult
1X1
011
000
423 || ( $ref ? $$list : $list ) !~ m/^(1|0)$/ )
424 {
425 2 die
426 qq{Optional[Bool]: invalid value $list for variable \$list in method _yaml_write_string_YAML};
427 }
428 0 ▶ $list = !!( $ref ? $$list : $list ) ? 1 : 0;
Branch: 2 branches
BranchTrueFalseTotal
!!($ref ? $$list : $list) ? : 0 0 0
$ref ? : 0 0 0
429 }
430  
431 0 my $code = q||;
432 0 ▶ $code .= qq|$param = | if $param;
Branch: 1 branch
BranchTrueFalseTotal
if $param 0 0 0
433 0 $code .= qq|YAML::Dump($content)|;
434 0 ▶ $code .= $list ? q|,| : q|;|;
Branch: 1 branch
BranchTrueFalseTotal
$list ? : 0 0 0
435 0 return $code;
436  
437 }
438  
439 sub _yaml_write_string_YAML_XS {
440 8 ▶ my ( $self, $mg, $content, $param, $list ) = @_;
Subroutine _yaml_write_string_YAML_XS: called CC=18 SCAR=38.5
441 8 ▶ if ( ( ref($mg) || "" ) =~ m/^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $mg || "") =~ /^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/) 2 6 8
Condition100%2/2
ref $mg || ''
l!l
71
MC/DC100%1/1
ref $mg || ''
ref $mg
Truth table100%2/2
A
A= ref $mg
Aresult
11
00
442 2 ▶ $mg = defined $mg ? $mg : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $mg ? : 2 0 2
443 2 die
444 qq{Object: invalid value $mg for variable \$mg in method _yaml_write_string_YAML_XS};
445 }
446 6 ▶ if ( !defined($content) || ref $content ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $content or ref $content) 2 4 6
Condition66%2/3
not defined $content or ref $content
l!l&&r!l&&!r
024
MC/DC50%1/2
not defined $content or ref $content
not defined $content ref $content
Truth table66%2/3
not(A) or B
A= not defined $contentB= ref $content
ABresult
1X1
011
000
447 2 ▶ $content = defined $content ? $content : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $content ? : 2 0 2
448 2 die
449 qq{Str: invalid value $content for variable \$content in method _yaml_write_string_YAML_XS};
450 }
451 4 ▶ if ( defined $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $param) 2 2 4
452 2 ▶ if ( ref $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $param) 2 0 2
453 2 die
454 qq{Optional[Str]: invalid value $param for variable \$param in method _yaml_write_string_YAML_XS};
455 }
456 }
457 2 ▶ if ( defined $list ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $list) 2 0 2
458 2 my $ref = ref $list;
459 2 ▶ if ( ( $ref || 'SCALAR' ) ne 'SCALAR'
Branch: 2 branches
BranchTrueFalseTotal
if (($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/) 2 0 2
$ref ? : 0 0 0
Condition40%2/5
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
l!l&&r!l&&!r
200
$ref || 'SCALAR'
l!l
20
MC/DC0%0/2
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
$ref not +($ref ? $$list : $list) =~ /^(1|0)$/
Truth table33%1/3
A or not(B)
A= $refB= not +($ref ? $$list : $list) =~ /^(1|0)$/
ABresult
1X1
011
000
460 || ( $ref ? $$list : $list ) !~ m/^(1|0)$/ )
461 {
462 2 die
463 qq{Optional[Bool]: invalid value $list for variable \$list in method _yaml_write_string_YAML_XS};
464 }
465 0 ▶ $list = !!( $ref ? $$list : $list ) ? 1 : 0;
Branch: 2 branches
BranchTrueFalseTotal
!!($ref ? $$list : $list) ? : 0 0 0
$ref ? : 0 0 0
466 }
467  
468 0 my $code = q||;
469 0 ▶ $code .= qq|$param = | if $param;
Branch: 1 branch
BranchTrueFalseTotal
if $param 0 0 0
470 0 $code .= qq|Dump($content)|;
471 0 ▶ $code .= $list ? q|,| : q|;|;
Branch: 1 branch
BranchTrueFalseTotal
$list ? : 0 0 0
472 0 return $code;
473  
474 }
475  
476 sub _yaml_write_string_YAML_PP {
477 8 ▶ my ( $self, $mg, $content, $param, $list ) = @_;
Subroutine _yaml_write_string_YAML_PP: called CC=18 SCAR=38.5
478 8 ▶ if ( ( ref($mg) || "" ) =~ m/^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $mg || "") =~ /^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/) 2 6 8
Condition100%2/2
ref $mg || ''
l!l
71
MC/DC100%1/1
ref $mg || ''
ref $mg
Truth table100%2/2
A
A= ref $mg
Aresult
11
00
479 2 ▶ $mg = defined $mg ? $mg : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $mg ? : 2 0 2
480 2 die
481 qq{Object: invalid value $mg for variable \$mg in method _yaml_write_string_YAML_PP};
482 }
483 6 ▶ if ( !defined($content) || ref $content ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $content or ref $content) 2 4 6
Condition66%2/3
not defined $content or ref $content
l!l&&r!l&&!r
024
MC/DC50%1/2
not defined $content or ref $content
not defined $content ref $content
Truth table66%2/3
not(A) or B
A= not defined $contentB= ref $content
ABresult
1X1
011
000
484 2 ▶ $content = defined $content ? $content : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $content ? : 2 0 2
485 2 die
486 qq{Str: invalid value $content for variable \$content in method _yaml_write_string_YAML_PP};
487 }
488 4 ▶ if ( defined $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $param) 2 2 4
489 2 ▶ if ( ref $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $param) 2 0 2
490 2 die
491 qq{Optional[Str]: invalid value $param for variable \$param in method _yaml_write_string_YAML_PP};
492 }
493 }
494 2 ▶ if ( defined $list ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $list) 2 0 2
495 2 my $ref = ref $list;
496 2 ▶ if ( ( $ref || 'SCALAR' ) ne 'SCALAR'
Branch: 2 branches
BranchTrueFalseTotal
if (($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/) 2 0 2
$ref ? : 0 0 0
Condition40%2/5
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
l!l&&r!l&&!r
200
$ref || 'SCALAR'
l!l
20
MC/DC0%0/2
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
$ref not +($ref ? $$list : $list) =~ /^(1|0)$/
Truth table33%1/3
A or not(B)
A= $refB= not +($ref ? $$list : $list) =~ /^(1|0)$/
ABresult
1X1
011
000
497 || ( $ref ? $$list : $list ) !~ m/^(1|0)$/ )
498 {
499 2 die
500 qq{Optional[Bool]: invalid value $list for variable \$list in method _yaml_write_string_YAML_PP};
501 }
502 0 ▶ $list = !!( $ref ? $$list : $list ) ? 1 : 0;
Branch: 2 branches
BranchTrueFalseTotal
!!($ref ? $$list : $list) ? : 0 0 0
$ref ? : 0 0 0
503 }
504  
505 0 my $code = q|my $wpp = YAML::PP->new;|;
506 0 ▶ $code .= qq|$param = | if $param;
Branch: 1 branch
BranchTrueFalseTotal
if $param 0 0 0
507 0 $code .= qq|\$wpp->dump_string($content)|;
508 0 ▶ $code = $list ? qq|do { $code },| : qq|$code;|;
Branch: 1 branch
BranchTrueFalseTotal
$list ? : 0 0 0
509 0 return $code;
510  
511 }
512  
513 sub yaml_write_file {
514 10 ▶ my ( $self, $mg, $file, $content, $param, $list ) = @_;
Subroutine yaml_write_file: called CC=20 SCAR=37.8
Pod documented
515 10 ▶ if ( ( ref($mg) || "" ) =~ m/^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $mg || "") =~ /^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/) 2 8 10
Condition100%2/2
ref $mg || ''
l!l
91
MC/DC100%1/1
ref $mg || ''
ref $mg
Truth table100%2/2
A
A= ref $mg
Aresult
11
00
516 2 ▶ $mg = defined $mg ? $mg : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $mg ? : 2 0 2
517 2 die
518 qq{Object: invalid value $mg for variable \$mg in method yaml_write_file};
519 }
520 8 ▶ if ( !defined($file) || ref $file ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $file or ref $file) 2 6 8
Condition66%2/3
not defined $file or ref $file
l!l&&r!l&&!r
026
MC/DC50%1/2
not defined $file or ref $file
not defined $file ref $file
Truth table66%2/3
not(A) or B
A= not defined $fileB= ref $file
ABresult
1X1
011
000
521 2 ▶ $file = defined $file ? $file : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $file ? : 2 0 2
522 2 die
523 qq{Str: invalid value $file for variable \$file in method yaml_write_file};
524 }
525 6 ▶ if ( !defined($content) || ref $content ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $content or ref $content) 2 4 6
Condition66%2/3
not defined $content or ref $content
l!l&&r!l&&!r
024
MC/DC50%1/2
not defined $content or ref $content
not defined $content ref $content
Truth table66%2/3
not(A) or B
A= not defined $contentB= ref $content
ABresult
1X1
011
000
526 2 ▶ $content = defined $content ? $content : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $content ? : 2 0 2
527 2 die
528 qq{Str: invalid value $content for variable \$content in method yaml_write_file};
529 }
530 4 ▶ if ( defined $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $param) 2 2 4
531 2 ▶ if ( ref $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $param) 2 0 2
532 2 die
533 qq{Optional[Str]: invalid value $param for variable \$param in method yaml_write_file};
534 }
535 }
536 2 ▶ if ( defined $list ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $list) 2 0 2
537 2 my $ref = ref $list;
538 2 ▶ if ( ( $ref || 'SCALAR' ) ne 'SCALAR'
Branch: 2 branches
BranchTrueFalseTotal
if (($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/) 2 0 2
$ref ? : 0 0 0
Condition40%2/5
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
l!l&&r!l&&!r
200
$ref || 'SCALAR'
l!l
20
MC/DC0%0/2
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
$ref not +($ref ? $$list : $list) =~ /^(1|0)$/
Truth table33%1/3
A or not(B)
A= $refB= not +($ref ? $$list : $list) =~ /^(1|0)$/
ABresult
1X1
011
000
539 || ( $ref ? $$list : $list ) !~ m/^(1|0)$/ )
540 {
541 2 die
542 qq{Optional[Bool]: invalid value $list for variable \$list in method yaml_write_file};
543 }
544 0 ▶ $list = !!( $ref ? $$list : $list ) ? 1 : 0;
Branch: 2 branches
BranchTrueFalseTotal
!!($ref ? $$list : $list) ? : 0 0 0
$ref ? : 0 0 0
545 }
546  
547 0 ▶ unless ($CLASS_LOADED) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($CLASS_LOADED) 0 0 0
548 0 $mg->use($YAML_CLASS);
549 }
550 0 ( my $uf = $YAML_CLASS ) =~ s/\:\:/_/g;
551 0 my $cb = "_yaml_write_file_$uf";
552 0 return __PACKAGE__->$cb( $mg, $file, $content, $param, $list );
553  
554 }
555  
556 sub _yaml_write_file_YAML {
557 10 ▶ my ( $self, $mg, $file, $content, $param, $list ) = @_;
Subroutine _yaml_write_file_YAML: called CC=21 SCAR=39.4
558 10 ▶ if ( ( ref($mg) || "" ) =~ m/^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $mg || "") =~ /^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/) 2 8 10
Condition100%2/2
ref $mg || ''
l!l
91
MC/DC100%1/1
ref $mg || ''
ref $mg
Truth table100%2/2
A
A= ref $mg
Aresult
11
00
559 2 ▶ $mg = defined $mg ? $mg : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $mg ? : 2 0 2
560 2 die
561 qq{Object: invalid value $mg for variable \$mg in method _yaml_write_file_YAML};
562 }
563 8 ▶ if ( !defined($file) || ref $file ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $file or ref $file) 2 6 8
Condition66%2/3
not defined $file or ref $file
l!l&&r!l&&!r
026
MC/DC50%1/2
not defined $file or ref $file
not defined $file ref $file
Truth table66%2/3
not(A) or B
A= not defined $fileB= ref $file
ABresult
1X1
011
000
564 2 ▶ $file = defined $file ? $file : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $file ? : 2 0 2
565 2 die
566 qq{Str: invalid value $file for variable \$file in method _yaml_write_file_YAML};
567 }
568 6 ▶ if ( !defined($content) || ref $content ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $content or ref $content) 2 4 6
Condition66%2/3
not defined $content or ref $content
l!l&&r!l&&!r
024
MC/DC50%1/2
not defined $content or ref $content
not defined $content ref $content
Truth table66%2/3
not(A) or B
A= not defined $contentB= ref $content
ABresult
1X1
011
000
569 2 ▶ $content = defined $content ? $content : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $content ? : 2 0 2
570 2 die
571 qq{Str: invalid value $content for variable \$content in method _yaml_write_file_YAML};
572 }
573 4 ▶ if ( defined $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $param) 2 2 4
574 2 ▶ if ( ref $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $param) 2 0 2
575 2 die
576 qq{Optional[Str]: invalid value $param for variable \$param in method _yaml_write_file_YAML};
577 }
578 }
579 2 ▶ if ( defined $list ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $list) 2 0 2
580 2 my $ref = ref $list;
581 2 ▶ if ( ( $ref || 'SCALAR' ) ne 'SCALAR'
Branch: 2 branches
BranchTrueFalseTotal
if (($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/) 2 0 2
$ref ? : 0 0 0
Condition40%2/5
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
l!l&&r!l&&!r
200
$ref || 'SCALAR'
l!l
20
MC/DC0%0/2
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
$ref not +($ref ? $$list : $list) =~ /^(1|0)$/
Truth table33%1/3
A or not(B)
A= $refB= not +($ref ? $$list : $list) =~ /^(1|0)$/
ABresult
1X1
011
000
582 || ( $ref ? $$list : $list ) !~ m/^(1|0)$/ )
583 {
584 2 die
585 qq{Optional[Bool]: invalid value $list for variable \$list in method _yaml_write_file_YAML};
586 }
587 0 ▶ $list = !!( $ref ? $$list : $list ) ? 1 : 0;
Branch: 2 branches
BranchTrueFalseTotal
!!($ref ? $$list : $list) ? : 0 0 0
$ref ? : 0 0 0
588 }
589  
590 0 my $code = q||;
591 0 ▶ $code .= qq|$param = | if $param;
Branch: 1 branch
BranchTrueFalseTotal
if $param 0 0 0
592 0 $code .= qq|YAML::DumpFile($file, $content)|;
593 0 ▶ $code .= $list ? q|,| : q|;|;
Branch: 1 branch
BranchTrueFalseTotal
$list ? : 0 0 0
594 0 return $code;
595  
596 }
597  
598 sub _yaml_write_file_YAML_XS {
599 10 ▶ my ( $self, $mg, $file, $content, $param, $list ) = @_;
Subroutine _yaml_write_file_YAML_XS: called CC=21 SCAR=39.4
600 10 ▶ if ( ( ref($mg) || "" ) =~ m/^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $mg || "") =~ /^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/) 2 8 10
Condition100%2/2
ref $mg || ''
l!l
91
MC/DC100%1/1
ref $mg || ''
ref $mg
Truth table100%2/2
A
A= ref $mg
Aresult
11
00
601 2 ▶ $mg = defined $mg ? $mg : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $mg ? : 2 0 2
602 2 die
603 qq{Object: invalid value $mg for variable \$mg in method _yaml_write_file_YAML_XS};
604 }
605 8 ▶ if ( !defined($file) || ref $file ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $file or ref $file) 2 6 8
Condition66%2/3
not defined $file or ref $file
l!l&&r!l&&!r
026
MC/DC50%1/2
not defined $file or ref $file
not defined $file ref $file
Truth table66%2/3
not(A) or B
A= not defined $fileB= ref $file
ABresult
1X1
011
000
606 2 ▶ $file = defined $file ? $file : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $file ? : 2 0 2
607 2 die
608 qq{Str: invalid value $file for variable \$file in method _yaml_write_file_YAML_XS};
609 }
610 6 ▶ if ( !defined($content) || ref $content ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $content or ref $content) 2 4 6
Condition66%2/3
not defined $content or ref $content
l!l&&r!l&&!r
024
MC/DC50%1/2
not defined $content or ref $content
not defined $content ref $content
Truth table66%2/3
not(A) or B
A= not defined $contentB= ref $content
ABresult
1X1
011
000
611 2 ▶ $content = defined $content ? $content : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $content ? : 2 0 2
612 2 die
613 qq{Str: invalid value $content for variable \$content in method _yaml_write_file_YAML_XS};
614 }
615 4 ▶ if ( defined $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $param) 2 2 4
616 2 ▶ if ( ref $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $param) 2 0 2
617 2 die
618 qq{Optional[Str]: invalid value $param for variable \$param in method _yaml_write_file_YAML_XS};
619 }
620 }
621 2 ▶ if ( defined $list ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $list) 2 0 2
622 2 my $ref = ref $list;
623 2 ▶ if ( ( $ref || 'SCALAR' ) ne 'SCALAR'
Branch: 2 branches
BranchTrueFalseTotal
if (($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/) 2 0 2
$ref ? : 0 0 0
Condition40%2/5
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
l!l&&r!l&&!r
200
$ref || 'SCALAR'
l!l
20
MC/DC0%0/2
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
$ref not +($ref ? $$list : $list) =~ /^(1|0)$/
Truth table33%1/3
A or not(B)
A= $refB= not +($ref ? $$list : $list) =~ /^(1|0)$/
ABresult
1X1
011
000
624 || ( $ref ? $$list : $list ) !~ m/^(1|0)$/ )
625 {
626 2 die
627 qq{Optional[Bool]: invalid value $list for variable \$list in method _yaml_write_file_YAML_XS};
628 }
629 0 ▶ $list = !!( $ref ? $$list : $list ) ? 1 : 0;
Branch: 2 branches
BranchTrueFalseTotal
!!($ref ? $$list : $list) ? : 0 0 0
$ref ? : 0 0 0
630 }
631  
632 0 my $code = q||;
633 0 ▶ $code .= qq|$param = | if $param;
Branch: 1 branch
BranchTrueFalseTotal
if $param 0 0 0
634 0 $code .= qq|DumpFile($file, $content)|;
635 0 ▶ $code .= $list ? q|,| : q|;|;
Branch: 1 branch
BranchTrueFalseTotal
$list ? : 0 0 0
636 0 return $code;
637  
638 }
639  
640 sub _yaml_write_file_YAML_PP {
641 10 ▶ my ( $self, $mg, $file, $content, $param, $list ) = @_;
Subroutine _yaml_write_file_YAML_PP: called CC=21 SCAR=39.4
642 10 ▶ if ( ( ref($mg) || "" ) =~ m/^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $mg || "") =~ /^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/) 2 8 10
Condition100%2/2
ref $mg || ''
l!l
91
MC/DC100%1/1
ref $mg || ''
ref $mg
Truth table100%2/2
A
A= ref $mg
Aresult
11
00
643 2 ▶ $mg = defined $mg ? $mg : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $mg ? : 2 0 2
644 2 die
645 qq{Object: invalid value $mg for variable \$mg in method _yaml_write_file_YAML_PP};
646 }
647 8 ▶ if ( !defined($file) || ref $file ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $file or ref $file) 2 6 8
Condition66%2/3
not defined $file or ref $file
l!l&&r!l&&!r
026
MC/DC50%1/2
not defined $file or ref $file
not defined $file ref $file
Truth table66%2/3
not(A) or B
A= not defined $fileB= ref $file
ABresult
1X1
011
000
648 2 ▶ $file = defined $file ? $file : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $file ? : 2 0 2
649 2 die
650 qq{Str: invalid value $file for variable \$file in method _yaml_write_file_YAML_PP};
651 }
652 6 ▶ if ( !defined($content) || ref $content ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $content or ref $content) 2 4 6
Condition66%2/3
not defined $content or ref $content
l!l&&r!l&&!r
024
MC/DC50%1/2
not defined $content or ref $content
not defined $content ref $content
Truth table66%2/3
not(A) or B
A= not defined $contentB= ref $content
ABresult
1X1
011
000
653 2 ▶ $content = defined $content ? $content : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $content ? : 2 0 2
654 2 die
655 qq{Str: invalid value $content for variable \$content in method _yaml_write_file_YAML_PP};
656 }
657 4 ▶ if ( defined $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $param) 2 2 4
658 2 ▶ if ( ref $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $param) 2 0 2
659 2 die
660 qq{Optional[Str]: invalid value $param for variable \$param in method _yaml_write_file_YAML_PP};
661 }
662 }
663 2 ▶ if ( defined $list ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $list) 2 0 2
664 2 my $ref = ref $list;
665 2 ▶ if ( ( $ref || 'SCALAR' ) ne 'SCALAR'
Branch: 2 branches
BranchTrueFalseTotal
if (($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/) 2 0 2
$ref ? : 0 0 0
Condition40%2/5
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
l!l&&r!l&&!r
200
$ref || 'SCALAR'
l!l
20
MC/DC0%0/2
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$list : $list) =~ /^(1|0)$/
$ref not +($ref ? $$list : $list) =~ /^(1|0)$/
Truth table33%1/3
A or not(B)
A= $refB= not +($ref ? $$list : $list) =~ /^(1|0)$/
ABresult
1X1
011
000
666 || ( $ref ? $$list : $list ) !~ m/^(1|0)$/ )
667 {
668 2 die
669 qq{Optional[Bool]: invalid value $list for variable \$list in method _yaml_write_file_YAML_PP};
670 }
671 0 ▶ $list = !!( $ref ? $$list : $list ) ? 1 : 0;
Branch: 2 branches
BranchTrueFalseTotal
!!($ref ? $$list : $list) ? : 0 0 0
$ref ? : 0 0 0
672 }
673  
674 0 my $code = q|my \$wpp = YAML::PP->new;|;
675 0 ▶ $code .= qq|$param = | if $param;
Branch: 1 branch
BranchTrueFalseTotal
if $param 0 0 0
676 0 $code .= qq|\$wpp->load_file($file, $content);|;
677 0 ▶ $code = $list ? qq|do { $code },| : qq|$code;|;
Branch: 1 branch
BranchTrueFalseTotal
$list ? : 0 0 0
678 0 return $code;
679  
680 }
681  
682 2 1;
683  
684 __END__
685  
686 =head1 NAME
687  
688 Hades::Macro::YAML - Hades macro helpers for YAML
689  
690 =head1 VERSION
691  
692 Version 0.01
693  
694 =cut
695  
696 =head1 SYNOPSIS
697  
698 Quick summary of what the module does:
699  
700 Hades->run({
701 eval => q|
702 macro {
703 YAML
704 }
705 Kosmos {
706 geras $file :t(Str) :d('path/to/file.yml') {
707 €yaml_load_file($file);
708 }
709 }
710 |;
711 });
712  
713 ... generates ...
714  
715 package Kosmos;
716 use strict;
717 use warnings;
718 use YAML::XS;
719 our $VERSION = 0.01;
720  
721 sub new {
722 my ( $cls, %args ) = ( shift(), scalar @_ == 1 ? %{ $_[0] } : @_ );
723 my $self = bless {}, $cls;
724 my %accessors = ();
725 for my $accessor ( keys %accessors ) {
726 my $param
727 = defined $args{$accessor}
728 ? $args{$accessor}
729 : $accessors{$accessor}->{default};
730 my $value
731 = $self->$accessor( $accessors{$accessor}->{builder}
732 ? $accessors{$accessor}->{builder}->( $self, $param )
733 : $param );
734 unless ( !$accessors{$accessor}->{required} || defined $value ) {
735 die "$accessor accessor is required";
736 }
737 }
738 return $self;
739 }
740  
741 sub geras {
742 my ( $self, $file ) = @_;
743 $file = defined $file ? $file : 'path/to/file.yml';
744 if ( !defined($file) || ref $file ) {
745 $file = defined $file ? $file : 'undef';
746 die qq{Str: invalid value $file for variable \$file in method geras};
747 }
748  
749 LoadFile($file);
750 }
751  
752 1;
753  
754 =head1 SUBROUTINES/METHODS
755  
756 =head2 new
757  
758 Instantiate a new Hades::Macro::YAML object.
759  
760 Hades::Macro::YAML->new
761  
762 =head2 yaml_load_string
763  
764 call yaml_load_string method. Expects param $mg to be a Object, param $str to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
765  
766 $obj->yaml_load_string($mg, $str, $param, $list)
767  
768 =head2 _yaml_load_string_YAML
769  
770 call _yaml_load_string_YAML method. Expects param $mg to be a Object, param $str to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
771  
772 $obj->_yaml_load_string_YAML($mg, $str, $param, $list)
773  
774 =head2 _yaml_load_string_YAML_XS
775  
776 call _yaml_load_string_YAML_XS method. Expects param $mg to be a Object, param $str to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
777  
778 $obj->_yaml_load_string_YAML_XS($mg, $str, $param, $list)
779  
780 =head2 _yaml_load_string_YAML_PP
781  
782 call _yaml_load_string_YAML_PP method. Expects param $mg to be a Object, param $str to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
783  
784 $obj->_yaml_load_string_YAML_PP($mg, $str, $param, $list)
785  
786 =head2 yaml_load_file
787  
788 call yaml_load_file method. Expects param $mg to be a Object, param $file to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
789  
790 $obj->yaml_load_file($mg, $file, $param, $list)
791  
792 =head2 _yaml_load_file_YAML
793  
794 call _yaml_load_file_YAML method. Expects param $mg to be a Object, param $file to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
795  
796 $obj->_yaml_load_file_YAML($mg, $file, $param, $list)
797  
798 =head2 _yaml_load_file_YAML_XS
799  
800 call _yaml_load_file_YAML_XS method. Expects param $mg to be a Object, param $file to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
801  
802 $obj->_yaml_load_file_YAML_XS($mg, $file, $param, $list)
803  
804 =head2 _yaml_load_file_YAML_PP
805  
806 call _yaml_load_file_YAML_PP method. Expects param $mg to be a Object, param $file to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
807  
808 $obj->_yaml_load_file_YAML_PP($mg, $file, $param, $list)
809  
810 =head2 yaml_write_string
811  
812 call yaml_write_string method. Expects param $mg to be a Object, param $content to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
813  
814 $obj->yaml_write_string($mg, $content, $param, $list)
815  
816 =head2 _yaml_write_string_YAML
817  
818 call _yaml_write_string_YAML method. Expects param $mg to be a Object, param $content to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
819  
820 $obj->_yaml_write_string_YAML($mg, $content, $param, $list)
821  
822 =head2 _yaml_write_string_YAML_XS
823  
824 call _yaml_write_string_YAML_XS method. Expects param $mg to be a Object, param $content to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
825  
826 $obj->_yaml_write_string_YAML_XS($mg, $content, $param, $list)
827  
828 =head2 _yaml_write_string_YAML_PP
829  
830 call _yaml_write_string_YAML_PP method. Expects param $mg to be a Object, param $content to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
831  
832 $obj->_yaml_write_string_YAML_PP($mg, $content, $param, $list)
833  
834 =head2 yaml_write_file
835  
836 call yaml_write_file method. Expects param $mg to be a Object, param $file to be a Str, param $content to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
837  
838 $obj->yaml_write_file($mg, $file, $content, $param, $list)
839  
840 =head2 _yaml_write_file_YAML
841  
842 call _yaml_write_file_YAML method. Expects param $mg to be a Object, param $file to be a Str, param $content to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
843  
844 $obj->_yaml_write_file_YAML($mg, $file, $content, $param, $list)
845  
846 =head2 _yaml_write_file_YAML_XS
847  
848 call _yaml_write_file_YAML_XS method. Expects param $mg to be a Object, param $file to be a Str, param $content to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
849  
850 $obj->_yaml_write_file_YAML_XS($mg, $file, $content, $param, $list)
851  
852 =head2 _yaml_write_file_YAML_PP
853  
854 call _yaml_write_file_YAML_PP method. Expects param $mg to be a Object, param $file to be a Str, param $content to be a Str, param $param to be a Optional[Str], param $list to be a Optional[Bool].
855  
856 $obj->_yaml_write_file_YAML_PP($mg, $file, $content, $param, $list)
857  
858 =head1 ACCESSORS
859  
860 =head2 macro
861  
862 get or set macro.
863  
864 $obj->macro;
865  
866 $obj->macro($value);
867  
868 =head1 AUTHOR
869  
870 LNATION, C<< <email at lnation.org> >>
871  
872 =head1 BUGS
873  
874 Please report any bugs or feature requests to C<bug-hades::macro::yaml at rt.cpan.org>, or through
875 the web interface at L<https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Hades-Macro-YAML>. I will be notified, and then you'll
876 automatically be notified of progress on your bug as I make changes.
877  
878 =head1 SUPPORT
879  
880 You can find documentation for this module with the perldoc command.
881  
882 perldoc Hades::Macro::YAML
883  
884 You can also look for information at:
885  
886 =over 4
887  
888 =item * RT: CPAN's request tracker (report bugs here)
889  
890 L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Hades-Macro-YAML>
891  
892 =item * AnnoCPAN: Annotated CPAN documentation
893  
894 L<http://annocpan.org/dist/Hades-Macro-YAML>
895  
896 =item * CPAN Ratings
897  
898 L<https://cpanratings.perl.org/d/Hades-Macro-YAML>
899  
900 =item * Search CPAN
901  
902 L<https://metacpan.org/release/Hades-Macro-YAML>
903  
904 =back
905  
906 =head1 ACKNOWLEDGEMENTS
907  
908 =head1 LICENSE AND COPYRIGHT
909  
910 This software is Copyright (c) 2020 by LNATION.
911  
912 This is free software, licensed under:
913  
914 The Artistic License 2.0 (GPL Compatible)
915  
916 =cut
917  
918
↑ Summary