blib/lib/BigIP/LTM/ParseConfig.pm

filter: Statementstmt 22.3% 45 / 201 Branchbran 0.0% 0 / 74 Conditioncond 0.0% 0 / 36 MC/DCmcdc 0.0% 0 / 23 Subroutinesub 33.3% 14 / 42 Podpod 0.0% 0 / 24 totaltotal 14.7% 59 / 400 SCAR 77.1
CC
59
Cov
14%
_parse
254.8
write
210.0
_order
110.0
CRAP 2237.0
↑ Summary
1 package BigIP::LTM::ParseConfig;
2  
3 # CURRENTLY UNDER DEVELOMENT BY CARELINE
4  
5 1 our $VERSION = '0.8.2';
6 1 my $AUTOLOAD;
7  
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 # Initialize the module
12 sub new {
13 0 ▶ my $class = shift;
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
14  
15 0 my $self = {};
16 0 bless $self, $class;
17  
18 0 $self->{'ConfigFile'} = shift;
19  
20 0 return $self;
21 }
22  
23 # Return a list of objects
24 0 ▶sub monitors { return shift->_objectlist('monitor'); }
Subroutine monitors: not called CC=1 SCAR=6.9
Pod undocumented
25 0 ▶sub nodes { return shift->_objectlist('ltm node'); }
Subroutine nodes: not called CC=1 SCAR=6.9
Pod undocumented
26 0 ▶sub partitions { return shift->_objectlist('partition'); }
Subroutine partitions: not called CC=1 SCAR=6.9
Pod undocumented
27 0 ▶sub pools { return shift->_objectlist('ltm pool'); }
Subroutine pools: not called CC=1 SCAR=6.9
Pod undocumented
28 0 ▶sub profiles { return shift->_objectlist('ltm profile'); }
Subroutine profiles: not called CC=1 SCAR=6.9
Pod undocumented
29 0 ▶sub routes { return shift->_objectlist('net route'); }
Subroutine routes: not called CC=1 SCAR=6.9
Pod undocumented
30 0 ▶sub interfaces { return shift->_objectlist('net interface'); }
Subroutine interfaces: not called CC=1 SCAR=6.9
Pod undocumented
31 0 ▶sub rules { return shift->_objectlist('ltm rule'); }
Subroutine rules: not called CC=1 SCAR=6.9
Pod undocumented
32 0 ▶sub users { return shift->_objectlist('auth'); }
Subroutine users: not called CC=1 SCAR=6.9
Pod undocumented
33 0 ▶sub virtuals { return shift->_objectlist('ltm virtual'); }
Subroutine virtuals: not called CC=1 SCAR=6.9
Pod undocumented
34  
35 # Return an object hash
36 0 ▶sub monitor { return shift->_object( 'monitor', shift ); }
Subroutine monitor: not called CC=1 SCAR=6.9
Pod undocumented
37 0 ▶sub node { return shift->_object( 'ltm node', shift ); }
Subroutine node: not called CC=1 SCAR=6.9
Pod undocumented
38 0 ▶sub partition { return shift->_object( 'partition', shift ); }
Subroutine partition: not called CC=1 SCAR=6.9
Pod undocumented
39 0 ▶sub pool { return shift->_object( 'ltm pool', shift ); }
Subroutine pool: not called CC=1 SCAR=6.9
Pod undocumented
40 0 ▶sub profile { return shift->_object( 'ltm profile', shift ); }
Subroutine profile: not called CC=1 SCAR=6.9
Pod undocumented
41 0 ▶sub route { return shift->_object( 'net route', shift ); }
Subroutine route: not called CC=1 SCAR=6.9
Pod undocumented
42 0 ▶sub interface { return shift->_object( 'net interface', shift ); }
Subroutine interface: not called CC=1 SCAR=6.9
Pod undocumented
43 0 ▶sub rule { return shift->_object( 'ltm rule', shift ); }
Subroutine rule: not called CC=1 SCAR=6.9
Pod undocumented
44 0 ▶sub user { return shift->_object( 'auth', shift ); }
Subroutine user: not called CC=1 SCAR=6.9
Pod undocumented
45 0 ▶sub virtual { return shift->_object( 'ltm virtual', shift ); }
Subroutine virtual: not called CC=1 SCAR=6.9
Pod undocumented
46  
47 # Return a list of pool members
48 sub members {
49 0 ▶ my $self = shift;
Subroutine members: not called CC=4 SCAR=30.0
Pod undocumented
50 0 my $pool = shift;
51  
52 0 ▶ $self->{'Parsed'} ||= $self->_parse();
Condition0%0/3
$self->{"Parsed"} ||= $self->_parse
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"Parsed"} ||= $self->_parse
$self->{"Parsed"} $self->_parse
Truth table0%0/3
A ||= B
A= $self->{"Parsed"}B= $self->_parse
ABresult
1X1
011
000
53  
54 0 ▶ return 0 unless $self->{'Parsed'}->{'pool'}->{$pool}->{'members'};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"Parsed"}{"pool"}{$pool}{"members"} 0 0 0
55  
56 0 ▶ if ( ref $self->{'Parsed'}->{'pool'}->{$pool}->{'members'} eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self->{'Parsed'}{'pool'}{$pool}{'members'} eq 'ARRAY') { } 0 0 0
57 0 return @{ $self->{'Parsed'}->{'pool'}->{$pool}->{'members'} };
58 }
59 else {
60 0 return $self->{'Parsed'}->{'pool'}->{$pool}->{'members'};
61 }
62 }
63  
64 # Modify an object
65 sub modify {
66 0 ▶ my $self = shift;
Subroutine modify: not called CC=7 SCAR=40.3
Pod undocumented
67  
68 0 my ($arg);
69 0 %{$arg} = @_;
70  
71 0 ▶ return 0 unless $arg->{'type'} && $arg->{'key'};
Branch: 1 branch
BranchTrueFalseTotal
unless $arg->{"type"} and $arg->{"key"} 0 0 0
Condition0%0/3
$arg->{"type"} and $arg->{"key"}
!ll&&!rl&&r
000
MC/DC0%0/2
$arg->{"type"} and $arg->{"key"}
$arg->{"type"} $arg->{"key"}
Truth table0%0/3
A and B
A= $arg->{"type"}B= $arg->{"key"}
ABresult
0X0
100
111
72  
73 0 my $obj = $arg->{'type'};
74 0 my $key = $arg->{'key'};
75 0 delete $arg->{'type'};
76 0 delete $arg->{'key'};
77  
78 0 ▶ $self->{'Parsed'} ||= $self->_parse();
Condition0%0/3
$self->{"Parsed"} ||= $self->_parse
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"Parsed"} ||= $self->_parse
$self->{"Parsed"} $self->_parse
Truth table0%0/3
A ||= B
A= $self->{"Parsed"}B= $self->_parse
ABresult
1X1
011
000
79  
80 0 ▶ return 0 unless $self->{'Parsed'}->{$obj}->{$key};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"Parsed"}{$obj}{$key} 0 0 0
81  
82 0 foreach my $attr ( keys %{$arg} ) {
83 0 ▶ next unless $self->{'Parsed'}->{$obj}->{$key}->{$attr};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"Parsed"}{$obj}{$key}{$attr} 0 0 0
84 0 $self->{'Modify'}->{$obj}->{$key}->{$attr} = $arg->{$attr};
85 }
86  
87 0 return 1;
88 }
89  
90 # Write out a new configuration file
91 sub write {
92 0 ▶ my $self = shift;
Subroutine write: not called CC=14 SCAR=53.5
Pod undocumented
93 0 ▶ my $file = shift || $self->{'ConfigFile'};
Condition0%0/3
shift() || $self->{'ConfigFile'}
l!l&&r!l&&!r
000
MC/DC0%0/2
shift() || $self->{'ConfigFile'}
shift() $self->{'ConfigFile'}
Truth table0%0/3
A || B
A= shift()B= $self->{'ConfigFile'}
ABresult
1X1
011
000
94  
95 0 ▶ die "No changes found; no write necessary" unless $self->{'Modify'};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"Modify"} 0 0 0
96  
97 0 foreach my $obj (
98 qw( self partition route user monitor auth profile node pool rule virtual )
99 )
100 {
101 0 foreach my $key ( sort keys %{ $self->{'Parsed'}->{$obj} } ) {
102 0 ▶ if ( $self->{'Modify'}->{$obj}->{$key} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'Modify'}{$obj}{$key}) { } 0 0 0
103 0 $self->{'Output'} .= "$obj $key {\n";
104 0 foreach my $attr ( $self->_order($obj) ) {
105 0 ▶ next unless $self->{'Parsed'}->{$obj}->{$key}->{$attr};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"Parsed"}{$obj}{$key}{$attr} 0 0 0
106 $self->{'Modify'}->{$obj}->{$key}->{$attr}
107 0 ▶ ||= $self->{'Parsed'}->{$obj}->{$key}->{$attr};
Condition0%0/3
$self->{"Modify"}{$obj}{$key}{$attr} ||= $self->{"Parsed"}{$obj}{$key}{$attr}
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"Modify"}{$obj}{$key}{$attr} ||= $self->{"Parsed"}{$obj}{$key}{$attr}
$self->{"Modify"}{$obj}{$key}{$attr} $self->{"Parsed"}{$obj}{$key}{$attr}
Truth table0%0/3
A ||= B
A= $self->{"Modify"}{$obj}{$key}{$attr}B= $self->{"Parsed"}{$obj}{$key}{$attr}
ABresult
1X1
011
000
108 0 ▶ if (ref $self->{'Modify'}->{$obj}->{$key}->{$attr} eq
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self->{'Modify'}{$obj}{$key}{$attr} eq 'ARRAY') { } 0 0 0
109 'ARRAY' )
110 {
111 0 ▶ if ( @{ $self->{'Modify'}->{$obj}->{$key}->{$attr} }
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self->{'Modify'}{$obj}{$key}{$attr};} > 1) { } 0 0 0
112 > 1 )
113 {
114 0 $self->{'Output'} .= " $attr\n";
115 0 foreach my $val (
116 0 @{ $self->{'Modify'}->{$obj}->{$key}->{$attr}
117 }
118 )
119 {
120 0 $self->{'Output'} .= " $val\n";
121 0 ▶ if ( $self->{'Parsed'}->{$obj}->{$key}
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Parsed"}{$obj}{$key}{"_xtra"}{$val}) 0 0 0
122 ->{'_xtra'}->{$val} )
123 {
124 $self->{'Output'}
125 .= ' '
126 . $self->{'Parsed'}->{$obj}->{$key}
127 0 ->{'_xtra'}->{$val} . "\n";
128 }
129 }
130 }
131 else {
132 $self->{'Output'}
133 .= " $attr "
134 . $self->{'Modify'}->{$obj}->{$key}
135 0 ->{$attr}[0] . "\n";
136 }
137 }
138 else {
139 $self->{'Output'}
140 .= " $attr "
141 0 . $self->{'Modify'}->{$obj}->{$key}->{$attr}
142 . "\n";
143 }
144 }
145 0 $self->{'Output'} .= "}\n";
146 }
147 else {
148 0 $self->{'Output'} .= $self->{'Raw'}->{$obj}->{$key};
149 }
150 }
151 }
152  
153 0 ▶ open FILE, ">$file" || return 0;
Condition0%0/2
">$file" || (return 0)
l!l
00
MC/DC0%0/1
">$file" || (return 0)
">$file"
Truth table0%0/2
A
A= ">$file"
Aresult
11
00
154 0 print FILE $self->{'Output'};
155 0 close FILE;
156  
157 0 return 1;
158 }
159  
160 # Return an object hash
161 sub _object {
162 0 ▶ my $self = shift;
Subroutine _object: not called CC=3 SCAR=24.8
163 0 my $obj = shift;
164 0 my $var = shift;
165  
166 0 ▶ $self->{'Parsed'} ||= $self->_parse();
Condition0%0/3
$self->{"Parsed"} ||= $self->_parse
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"Parsed"} ||= $self->_parse
$self->{"Parsed"} $self->_parse
Truth table0%0/3
A ||= B
A= $self->{"Parsed"}B= $self->_parse
ABresult
1X1
011
000
167  
168 0 ▶ return $self->{'Parsed'}->{$obj}->{$var} || 0;
Condition0%0/2
$self->{'Parsed'}{$obj}{$var} || 0
l!l
00
MC/DC0%0/1
$self->{'Parsed'}{$obj}{$var} || 0
$self->{'Parsed'}{$obj}{$var}
Truth table0%0/2
A
A= $self->{'Parsed'}{$obj}{$var}
Aresult
11
00
169 }
170  
171 # Return a list of objects
172 sub _objectlist {
173 0 ▶ my $self = shift;
Subroutine _objectlist: not called CC=3 SCAR=24.8
174 0 my $obj = shift;
175  
176 0 ▶ $self->{'Parsed'} ||= $self->_parse();
Condition0%0/3
$self->{"Parsed"} ||= $self->_parse
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"Parsed"} ||= $self->_parse
$self->{"Parsed"} $self->_parse
Truth table0%0/3
A ||= B
A= $self->{"Parsed"}B= $self->_parse
ABresult
1X1
011
000
177  
178 0 ▶ if ( $self->{'Parsed'}->{$obj} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'Parsed'}{$obj}) { } 0 0 0
179 0 return keys %{ $self->{'Parsed'}->{$obj} };
180 }
181 else {
182 0 return 0;
183 }
184 }
185  
186 # Define object attribute ordering
187 sub _order {
188 0 ▶ my $self = shift;
Subroutine _order: not called CC=10 SCAR=47.0
189  
190 0 for (shift) {
191 0 ▶ /auth/ && return qw( bind login search servers service ssl user );
Branch: 1 branch
BranchTrueFalseTotal
/auth/ and return "bind", "login", "search", "servers", "service", "ssl", "user" 0 0 0
192 0 ▶ /monitor/
Branch: 1 branch
BranchTrueFalseTotal
/monitor/ and return "default", "base", "debug", "filter", "mandatoryattrs", "password", "security", "username", "interval", "timeout", "manual", "dest", "recv", "send" 0 0 0
193 && return
194 qw( default base debug filter mandatoryattrs password security username interval timeout manual dest recv send );
195 0 ▶ /node/ && return qw( monitor screen );
Branch: 1 branch
BranchTrueFalseTotal
/node/ and return "monitor", "screen" 0 0 0
196 0 ▶ /partition/ && return qw( description );
Branch: 1 branch
BranchTrueFalseTotal
/partition/ and return "description" 0 0 0
197 0 ▶ /pool/ && return qw( lb nat monitor members );
Branch: 1 branch
BranchTrueFalseTotal
/pool/ and return "lb", "nat", "monitor", "members" 0 0 0
198 0 ▶ /self/ && return qw( netmask unit floating vlan allow );
Branch: 1 branch
BranchTrueFalseTotal
/self/ and return "netmask", "unit", "floating", "vlan", "allow" 0 0 0
199 0 ▶ /user/ && return qw( password description id group home shell role );
Branch: 1 branch
BranchTrueFalseTotal
/user/ and return "password", "description", "id", "group", "home", "shell", "role" 0 0 0
200 0 ▶ /virtual/
Branch: 1 branch
BranchTrueFalseTotal
/virtual/ and return "translate", "snat", "pool", "destination", "ip", "rules", "profiles", "persist" 0 0 0
201 && return
202 qw( translate snat pool destination ip rules profiles persist );
203  
204 0 return 0;
205 }
206 }
207  
208 # Parse the configuration file
209 sub _parse {
210 0 ▶ my $self = shift;
Subroutine _parse: not called CC=24 SCAR=55.4
211 0 ▶ my $file = shift || $self->{'ConfigFile'};
Condition0%0/3
shift() || $self->{'ConfigFile'}
l!l&&r!l&&!r
000
MC/DC0%0/2
shift() || $self->{'ConfigFile'}
shift() $self->{'ConfigFile'}
Truth table0%0/3
A || B
A= shift()B= $self->{'ConfigFile'}
ABresult
1X1
011
000
212  
213 die "File not found: $self->{'ConfigFile'}\n"
214 0 ▶ unless -e $self->{'ConfigFile'};
Branch: 1 branch
BranchTrueFalseTotal
unless -e $self->{"ConfigFile"} 0 0 0
215  
216 0 ▶ open FILE, $file || return 0;
Condition0%0/2
$file || (return 0)
l!l
00
MC/DC0%0/1
$file || (return 0)
$file
Truth table0%0/2
A
A= $file
Aresult
11
00
217 0 my @file = <FILE>;
218 0 close FILE;
219  
220 0 my ( $data, $parsed );
221  
222 0 ▶ until ( !$file[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (not $file[0]) 0 0 0
223 0 my $ln = shift @file;
224  
225 0 ▶ if ( $ln
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^(auth|patition|cli|ltm node|ltm pool|ltm profile|ltm rule|ltm virtual|net self|net route|net interface)\s(.*)\s\{(\s?\}?)$/) 0 0 0
226 =~ /^(auth|patition|cli|ltm node|ltm pool|ltm profile|ltm rule|ltm virtual|net self|net route|net interface)\s(.*)\s\{(\s?\}?)$/
227 )
228 {
229 0 $data->{'obj'} = $1;
230 0 $data->{'key'} = $2;
231 }
232  
233 0 ▶ if ( $data->{'obj'} && $data->{'key'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($data->{"obj"} and $data->{"key"}) 0 0 0
Condition0%0/3
$data->{"obj"} and $data->{"key"}
!ll&&!rl&&r
000
MC/DC0%0/2
$data->{"obj"} and $data->{"key"}
$data->{"obj"} $data->{"key"}
Truth table0%0/3
A and B
A= $data->{"obj"}B= $data->{"key"}
ABresult
0X0
100
111
234 0 $self->{'Raw'}->{ $data->{'obj'} }->{ $data->{'key'} } .= $ln;
235  
236 #缩进为4且{}非空哈希
237 0 ▶ if ( $ln =~ /^\s{4}(\S+)\s\{$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{4}(\S+)\s\{$/) 0 0 0
238 0 $data->{'list1'} = $1;
239 0 next;
240 }
241  
242 #缩进为8且{}非空哈希
243 0 ▶ if ( $ln =~ /^\s{8}(\S+)\s\{$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{8}(\S+)\s\{$/) 0 0 0
244 0 $data->{'list2'} = $1;
245 0 next;
246 }
247  
248 #捕捉代码块结束符并清空
249 0 ▶ if ( $ln =~ /^\s{4}\}$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{4}\}$/) 0 0 0
250 0 delete $data->{'list1'};
251 0 next;
252 }
253  
254 #捕捉代码块结束符并清空
255 0 ▶ if ( $ln =~ /^\s{8}\}$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{8}\}$/) 0 0 0
256 0 delete $data->{'list2'};
257 0 next;
258 }
259  
260 #缩进为4且携带{}空哈希
261 0 ▶ if ( $ln =~ /^\s{4}(\S+)\s\{\s\}$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{4}(\S+)\s\{\s\}$/) 0 0 0
262 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
263 0 $parsed->{ $data->{'obj'} }->{ $data->{'key'} }->{$1} = undef;
264 1 ▶ use strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
265 0 next;
266 }
267  
268 0 ▶ if ( $data->{'list1'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($data->{"list1"}) 0 0 0
269  
270 #缩进为8且携带{}空哈希
271 0 ▶ if ( $ln =~ /^\s{8}(\S+)\s\{\s\}$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{8}(\S+)\s\{\s\}$/) 0 0 0
272 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
273 $parsed->{ $data->{'obj'} }->{ $data->{'key'} }
274 0 ->{ $data->{'list1'} }->{$1} = undef;
275 1 ▶ use strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
276 0 next;
277 }
278  
279 #缩进为8且为键值对
280 0 ▶ if ( $ln =~ /^\s{8}(\S+)\s(\S+)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{8}(\S+)\s(\S+)$/) 0 0 0
281 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
282 $parsed->{ $data->{'obj'} }->{ $data->{'key'} }
283 0 ->{ $data->{'list1'} }->{$1} = $2;
284 1 ▶ use strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
285 0 next;
286 }
287  
288 #缩进为8且为标量数据
289 0 ▶ if ( $ln =~ /^\s{8}(\S+)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{8}(\S+)$/) 0 0 0
290 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
291 $parsed->{ $data->{'obj'} }->{ $data->{'key'} }
292 0 ->{ $data->{'list1'} } = $1;
293 1 ▶ use strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
294 0 next;
295 }
296 }
297  
298 0 ▶ if ( $data->{'list2'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($data->{"list2"}) 0 0 0
299  
300 #缩进为12且为空哈希(暂时忽略缩进为12且嵌套键值对的清空) -- 待完善
301 0 ▶ if ( $ln =~ /^\s{12}(\S+)\s\{\s\}$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{12}(\S+)\s\{\s\}$/) 0 0 0
302 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
303 $parsed->{ $data->{'obj'} }->{ $data->{'key'} }
304 0 ->{ $data->{'list1'} }->{ $data->{'list2'} }->{$1}
305 = undef;
306 1 ▶ use strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
307 0 next;
308 }
309  
310 #缩进为12且为键值对
311 0 ▶ if ( $ln =~ /^\s{12}(\S+)\s(\S+)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{12}(\S+)\s(\S+)$/) 0 0 0
312 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
313 $parsed->{ $data->{'obj'} }->{ $data->{'key'} }
314 0 ->{ $data->{'list1'} }->{ $data->{'list2'} }->{$1}
315 = $2;
316 1 ▶ use strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
317 0 next;
318 }
319 }
320  
321 #兜底策略解析
322 0 ▶ if ( $ln =~ /^\s{4}(\S+)\s(\S+)\s+?$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{4}(\S+)\s(\S+)\s+?$/) 0 0 0
323 0 say $ln;
324 0 $parsed->{ $data->{'obj'} }->{ $data->{'key'} }->{$1} = $2;
325 0 next;
326 }
327 }
328 }
329  
330 # Fill in ill-formatted objects
331 0 foreach my $obj ( keys %{ $self->{'Raw'} } ) {
332 0 foreach my $key ( keys %{ $self->{'Raw'}->{$obj} } ) {
333 0 ▶ $parsed->{$obj}->{$key} ||= $self->{'Raw'}->{$obj}->{$key};
Condition0%0/3
$parsed->{$obj}{$key} ||= $self->{"Raw"}{$obj}{$key}
l!l&&r!l&&!r
000
MC/DC0%0/2
$parsed->{$obj}{$key} ||= $self->{"Raw"}{$obj}{$key}
$parsed->{$obj}{$key} $self->{"Raw"}{$obj}{$key}
Truth table0%0/3
A ||= B
A= $parsed->{$obj}{$key}B= $self->{"Raw"}{$obj}{$key}
ABresult
1X1
011
000
334 }
335 }
336  
337 0 return $parsed;
338 }
339  
340 1 1;
↑ Summary