blib/lib/BigIP/GTM/ParseConfig.pm

filter: Statementstmt 4.4% 14 / 316 Branchbran 0.0% 0 / 158 Conditioncond 0.0% 0 / 98 MC/DCmcdc 0.0% 0 / 58 Subroutinesub 8.8% 4 / 45 Podpod 37.8% 14 / 37 totaltotal 4.4% 32 / 712 SCAR 96.7
CC
130
Cov
2%
_parse
4290.0
wideips_all
240.0
wideip_detail
210.0
CRAP 15819.2
↑ Summary
1 package BigIP::GTM::ParseConfig;
2  
3 # CURRENTLY UNDER DEVELOMENT BY WENWU YAN
4 #----------------------------------------------------------------------------
5 # The contents of this file are subject to the iControl Public License
6 # Version 4.5 (the "License"); you may not use this file except in
7 # compliance with the License. You may obtain a copy of the License at
8 # http://www.f5.com/.
9 #
10 # Software distributed under the License is distributed on an "AS IS"
11 # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
12 # the License for the specific language governing rights and limitations
13 # under the License.
14 #
15 # The Original Code is iControl Code and related documentation
16 # distributed by F5.
17 #
18 # The Initial Developer of the Original Code is F5 Networks,
19 # Inc. Seattle, WA, USA. Portions created by F5 are Copyright (C) 1996-2020 F5 Networks,
20 # Inc. All Rights Reserved. iControl (TM) is a registered trademark of F5 Networks, Inc.
21 #
22 # Alternatively, the contents of this file may be used under the terms
23 # of the GNU General Public License (the "GPL"), in which case the
24 # provisions of GPL are applicable instead of those above. If you wish
25 # to allow use of your version of this file only under the terms of the
26 # GPL and not to allow others to use your version of this file under the
27 # License, indicate your decision by deleting the provisions above and
28 # replace them with the notice and other provisions required by the GPL.
29 # If you do not delete the provisions above, a recipient may use your
30 # version of this file under either the License or the GPL.
31 #----------------------------------------------------------------------------
32  
33 #----------------------------------------------------------------------------
34 # Initialize the module
35 #----------------------------------------------------------------------------
36 1 our $VERSION = '0.83';
37 1 my $AUTOLOAD;
38  
39 1 ▶use 5.012;
Subroutine BEGIN: called CC=1 SCAR=0.0
40 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
41 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
42 1 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
43  
44 # Initialize the module
45 sub new {
46 0 ▶ my $class = shift;
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
47  
48 0 my $self = {};
49 0 bless $self, $class;
50  
51 0 $self->{'ConfigFile'} = shift;
52  
53 0 return $self;
54 }
55  
56 #----------------------------------------------------------------------------
57 # Return a list of objects for ltm
58 #----------------------------------------------------------------------------
59 0 ▶sub regions { return shift->_objectlist('gtm region'); }
Subroutine regions: not called CC=1 SCAR=6.9
Pod undocumented
60 0 ▶sub wideips { return shift->_objectlist('gtm wideip'); }
Subroutine wideips: not called CC=1 SCAR=6.9
Pod undocumented
61 0 ▶sub pools { return shift->_objectlist('gtm pool'); }
Subroutine pools: not called CC=1 SCAR=6.9
Pod documented
62 0 ▶sub servers { return shift->_objectlist('gtm server'); }
Subroutine servers: not called CC=1 SCAR=6.9
Pod undocumented
63 0 ▶sub monitors { return shift->_objectlist('gtm monitor'); }
Subroutine monitors: not called CC=1 SCAR=6.9
Pod documented
64 0 ▶sub partitions { return shift->_objectlist('partition'); }
Subroutine partitions: not called CC=1 SCAR=6.9
Pod documented
65 0 ▶sub routes { return shift->_objectlist('net route'); }
Subroutine routes: not called CC=1 SCAR=6.9
Pod documented
66 0 ▶sub selfs { return shift->_objectlist('net self'); }
Subroutine selfs: not called CC=1 SCAR=6.9
Pod undocumented
67 0 ▶sub vlans { return shift->_objectlist('net vlan'); }
Subroutine vlans: not called CC=1 SCAR=6.9
Pod undocumented
68 0 ▶sub trunks { return shift->_objectlist('net trunk'); }
Subroutine trunks: not called CC=1 SCAR=6.9
Pod undocumented
69 0 ▶sub interfaces { return shift->_objectlist('net interface'); }
Subroutine interfaces: not called CC=1 SCAR=6.9
Pod undocumented
70 0 ▶sub mgmt_routes { return shift->_objectlist('sys management-route'); }
Subroutine mgmt_routes: not called CC=1 SCAR=6.9
Pod undocumented
71 0 ▶sub users { return shift->_objectlist('auth user'); }
Subroutine users: not called CC=1 SCAR=6.9
Pod documented
72  
73 #----------------------------------------------------------------------------
74 # Return a list of objects for net
75 #----------------------------------------------------------------------------
76 0 ▶sub region { return shift->_object( 'gtm region', shift ); }
Subroutine region: not called CC=1 SCAR=6.9
Pod undocumented
77 0 ▶sub wideip { return shift->_object( 'gtm wideip', shift ); }
Subroutine wideip: not called CC=1 SCAR=6.9
Pod undocumented
78 0 ▶sub pool { return shift->_object( 'gtm pool', shift ); }
Subroutine pool: not called CC=1 SCAR=6.9
Pod documented
79 0 ▶sub server { return shift->_object( 'gtm server', shift ); }
Subroutine server: not called CC=1 SCAR=6.9
Pod undocumented
80 0 ▶sub monitor { return shift->_object( 'gtm monitor', shift ); }
Subroutine monitor: not called CC=1 SCAR=6.9
Pod documented
81 0 ▶sub partition { return shift->_object( 'partition', shift ); }
Subroutine partition: not called CC=1 SCAR=6.9
Pod documented
82 0 ▶sub self { return shift->_object( 'net self', shift ); }
Subroutine self: not called CC=1 SCAR=6.9
Pod undocumented
83 0 ▶sub route { return shift->_object( 'net route', shift ); }
Subroutine route: not called CC=1 SCAR=6.9
Pod documented
84 0 ▶sub vlan { return shift->_object( 'net vlan', shift ); }
Subroutine vlan: not called CC=1 SCAR=6.9
Pod undocumented
85 0 ▶sub trunk { return shift->_object( 'net trunk', shift ); }
Subroutine trunk: not called CC=1 SCAR=6.9
Pod undocumented
86 0 ▶sub interface { return shift->_object( 'net interface', shift ); }
Subroutine interface: not called CC=1 SCAR=6.9
Pod undocumented
87 0 ▶sub mgmt_route { return shift->_object( 'sys management-route', shift ); }
Subroutine mgmt_route: not called CC=1 SCAR=6.9
Pod undocumented
88 0 ▶sub snmp { return shift->_object( 'sys', 'snmp' ); }
Subroutine snmp: not called CC=1 SCAR=6.9
Pod undocumented
89 0 ▶sub sshd { return shift->_object( 'sys', 'sshd' ); }
Subroutine sshd: not called CC=1 SCAR=6.9
Pod undocumented
90 0 ▶sub ntp { return shift->_object( 'sys', 'ntp' ); }
Subroutine ntp: not called CC=1 SCAR=6.9
Pod undocumented
91 0 ▶sub syslog { return shift->_object( 'sys', 'syslog' ); }
Subroutine syslog: not called CC=1 SCAR=6.9
Pod undocumented
92 0 ▶sub user { return shift->_object( 'auth user', shift ); }
Subroutine user: not called CC=1 SCAR=6.9
Pod documented
93  
94 #----------------------------------------------------------------------------
95 # Return a list of objects for others
96 #----------------------------------------------------------------------------
97 sub funcs {
98 0 ▶ my $self = shift;
Subroutine funcs: not called CC=3 SCAR=24.8
Pod undocumented
99  
100 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
101  
102 0 ▶ return keys %{ $self->{'Parsed'} } || 0;
Condition0%0/2
keys %{$$self{'Parsed'};} || 0
l!l
00
MC/DC0%0/1
keys %{$$self{'Parsed'};} || 0
keys %{$$self{'Parsed'};}
Truth table0%0/2
A
A= keys %{$$self{'Parsed'};}
Aresult
11
00
103 }
104  
105 # Return a list of pool members
106 sub members {
107 0 ▶ my $self = shift;
Subroutine members: not called CC=4 SCAR=30.0
Pod documented
108 0 my $pool = shift;
109  
110 0 my $members;
111 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
112  
113 0 ▶ return 0 unless $self->{'Parsed'}->{'gtm pool'}->{$pool}->{'members'};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"Parsed"}{"gtm pool"}{$pool}{"members"} 0 0 0
114  
115 0 ▶ if ( ref $self->{'Parsed'}->{'gtm pool'}->{$pool}->{'members'} eq 'HASH' )
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self->{'Parsed'}{'gtm pool'}{$pool}{'members'} eq 'HASH') { } 0 0 0
116 {
117 return
118 0 map {s/\:/\//r}
119 (
120 0 keys %{ $self->{'Parsed'}->{'gtm pool'}->{$pool}->{'members'} } );
121 }
122 else {
123 0 return $self->{'Parsed'}->{'gtm pool'}->{$pool}->{'members'};
124 }
125 }
126  
127 #----------------------------------------------------------------------------
128 # Return a list of wideips_all
129 #----------------------------------------------------------------------------
130 sub wideips_all {
131 0 ▶ my $self = shift;
Subroutine wideips_all: not called CC=15 SCAR=54.8
Pod undocumented
132 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
133  
134 0 ▶ return 0 unless $self->{'Parsed'}->{'gtm wideip'};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"Parsed"}{"gtm wideip"} 0 0 0
135  
136 # Loop for wideips()
137 0 foreach ( $self->wideips() ) {
138 0 my $ret = $self->wideip($_);
139 0 my $pools = $ret->{pools};
140  
141 0 foreach my $pool ( keys %{$pools} ) {
142 0 my $detail = $self->pool($pool);
143 0 ▶ my $members = $detail->{members} if defined $detail->{members};
Branch: 1 branch
BranchTrueFalseTotal
if defined $detail->{"members"} 0 0 0
144 0 $ret->{"detail"}{$pool}{"pool_detail"} = $detail;
145  
146 0 foreach my $serverAndVs ( keys %{$members} ) {
147 0 my ( $server, $vs ) = split( /\:/, $serverAndVs );
148 0 my $detail = $self->server($server);
149 0 ▶ my $virtual_server = $detail->{"virtual-servers"}{$vs} if $detail;
Branch: 1 branch
BranchTrueFalseTotal
if $detail 0 0 0
150 0 ▶ $ret->{"detail"}{$pool}{"server_detail"} ||= [];
Condition0%0/2
$ret->{"detail"}{$pool}{"server_detail"} ||= []
l!l
00
MC/DC0%0/1
$ret->{"detail"}{$pool}{"server_detail"} ||= []
$ret->{"detail"}{$pool}{"server_detail"}
Truth table0%0/2
A
A= $ret->{"detail"}{$pool}{"server_detail"}
Aresult
11
00
151 0 ▶ my $mem = $detail if $detail;
Branch: 1 branch
BranchTrueFalseTotal
if $detail 0 0 0
152 0 $mem->{"server"} = $server;
153 0 $mem->{"vs"} = $vs;
154 0 push @{$ret->{"detail"}{$pool}{"server_detail"}}, $mem;
155  
156 0 my $monitor = $virtual_server->{"monitor"};
157 0 ▶ if ( $monitor && $monitor =~ /http|tcp|udp|bigip|gateway_icmp/ ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($monitor and $monitor =~ /http|tcp|udp|bigip|gateway_icmp/u) { } 0 0 0
elsif ($monitor and $monitor =~ /\S+/u) { } 0 0 0
Condition0%0/3
$monitor and $monitor =~ /http|tcp|udp|bigip|gateway_icmp/u
!ll&&!rl&&r
000
MC/DC0%0/2
$monitor and $monitor =~ /http|tcp|udp|bigip|gateway_icmp/u
$monitor $monitor =~ /http|tcp|udp|bigip|gateway_icmp/u
Truth table0%0/3
A and B
A= $monitorB= $monitor =~ /http|tcp|udp|bigip|gateway_icmp/u
ABresult
0X0
100
111
158 0 next;
159 }
160 ▶ elsif ( $monitor && $monitor =~ /\S+/ ) {
Condition0%0/3
$monitor and $monitor =~ /\S+/u
!ll&&!rl&&r
000
MC/DC0%0/2
$monitor and $monitor =~ /\S+/u
$monitor $monitor =~ /\S+/u
Truth table0%0/3
A and B
A= $monitorB= $monitor =~ /\S+/u
ABresult
0X0
100
111
161 0 my $mon_detail = $self->monitor($monitor);
162 0 ▶ $ret->{"detail"}{$pool}{"monitor_detail"} = $mon_detail if $mon_detail;
Branch: 1 branch
BranchTrueFalseTotal
if $mon_detail 0 0 0
163 }
164 }
165 }
166 }
167  
168 0 return $self->{"Parsed"}{"gtm wideip"};
169 }
170  
171 #----------------------------------------------------------------------------
172 # Return a list of wideip_detail
173 #----------------------------------------------------------------------------
174 sub wideip_detail {
175 0 ▶ my $self = shift;
Subroutine wideip_detail: not called CC=14 SCAR=53.5
Pod undocumented
176 0 my $wideip = shift;
177  
178 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
179  
180 0 ▶ return 0 unless $self->{'Parsed'}->{'gtm wideip'};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"Parsed"}{"gtm wideip"} 0 0 0
181  
182 # Loop for wideips()
183 0 my $ret = $self->wideip($wideip);
184 0 my $pools = $ret->{pools};
185  
186 0 foreach my $pool ( keys %{$pools} ) {
187 0 my $detail = $self->pool($pool);
188 0 ▶ my $members = $detail->{members} if defined $detail->{members};
Branch: 1 branch
BranchTrueFalseTotal
if defined $detail->{"members"} 0 0 0
189 0 $ret->{"detail"}{$pool}{"pool_detail"} = $detail;
190  
191 0 foreach my $serverAndVs ( keys %{$members} ) {
192 0 my ( $server, $vs ) = split( /\:/, $serverAndVs );
193 0 my $detail = $self->server($server);
194 0 ▶ my $virtual_server = $detail->{"virtual-servers"}{$vs} if $detail;
Branch: 1 branch
BranchTrueFalseTotal
if $detail 0 0 0
195 0 ▶ $ret->{"detail"}{$pool}{"server_detail"} ||= [];
Condition0%0/2
$ret->{"detail"}{$pool}{"server_detail"} ||= []
l!l
00
MC/DC0%0/1
$ret->{"detail"}{$pool}{"server_detail"} ||= []
$ret->{"detail"}{$pool}{"server_detail"}
Truth table0%0/2
A
A= $ret->{"detail"}{$pool}{"server_detail"}
Aresult
11
00
196 0 ▶ my $mem = $detail if $detail;
Branch: 1 branch
BranchTrueFalseTotal
if $detail 0 0 0
197 0 $mem->{"server"} = $server;
198 0 $mem->{"vs"} = $vs;
199 0 push @{$ret->{"detail"}{$pool}{"server_detail"}}, $mem;
200  
201 0 my $monitor = $virtual_server->{"monitor"};
202 0 ▶ if ( $monitor && $monitor =~ /http|tcp|udp|bigip|gateway_icmp/ ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($monitor and $monitor =~ /http|tcp|udp|bigip|gateway_icmp/u) { } 0 0 0
elsif ($monitor and $monitor =~ /\S+/u) { } 0 0 0
Condition0%0/3
$monitor and $monitor =~ /http|tcp|udp|bigip|gateway_icmp/u
!ll&&!rl&&r
000
MC/DC0%0/2
$monitor and $monitor =~ /http|tcp|udp|bigip|gateway_icmp/u
$monitor $monitor =~ /http|tcp|udp|bigip|gateway_icmp/u
Truth table0%0/3
A and B
A= $monitorB= $monitor =~ /http|tcp|udp|bigip|gateway_icmp/u
ABresult
0X0
100
111
203 0 next;
204 }
205 ▶ elsif ( $monitor && $monitor =~ /\S+/ ) {
Condition0%0/3
$monitor and $monitor =~ /\S+/u
!ll&&!rl&&r
000
MC/DC0%0/2
$monitor and $monitor =~ /\S+/u
$monitor $monitor =~ /\S+/u
Truth table0%0/3
A and B
A= $monitorB= $monitor =~ /\S+/u
ABresult
0X0
100
111
206 0 my $mon_detail = $self->monitor($monitor);
207 0 ▶ $ret->{"detail"}{$pool}{"monitor_detail"} = $mon_detail if $mon_detail;
Branch: 1 branch
BranchTrueFalseTotal
if $mon_detail 0 0 0
208 }
209 }
210 }
211  
212 0 return $self->{Parsed}{"gtm wideip"}{$wideip};
213 }
214  
215 # Modify an object
216 sub modify {
217 0 ▶ my $self = shift;
Subroutine modify: not called CC=7 SCAR=40.3
Pod documented
218  
219 0 my ($arg);
220 0 %{$arg} = @_;
221  
222 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
223  
224 0 my $obj = $arg->{'type'};
225 0 my $key = $arg->{'key'};
226 0 delete $arg->{'type'};
227 0 delete $arg->{'key'};
228  
229 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
230  
231 0 ▶ return 0 unless $self->{'Parsed'}->{$obj}->{$key};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"Parsed"}{$obj}{$key} 0 0 0
232  
233 0 foreach my $attr ( keys %{$arg} ) {
234 0 ▶ next unless $self->{'Parsed'}->{$obj}->{$key}->{$attr};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"Parsed"}{$obj}{$key}{$attr} 0 0 0
235 0 $self->{'Modify'}->{$obj}->{$key}->{$attr} = $arg->{$attr};
236 }
237  
238 0 return 1;
239 }
240  
241 # Write out a new configuration file
242 sub write {
243 0 ▶ my $self = shift;
Subroutine write: not called CC=14 SCAR=53.5
Pod documented
244 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
245  
246 0 ▶ die "No changes found; no write necessary" unless $self->{'Modify'};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"Modify"} 0 0 0
247  
248 0 foreach my $obj (
249 qw( self partition route user monitor auth profile node pool rule virtual )
250 )
251 {
252 0 foreach my $key ( sort keys %{ $self->{'Parsed'}->{$obj} } ) {
253 0 ▶ if ( $self->{'Modify'}->{$obj}->{$key} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'Modify'}{$obj}{$key}) { } 0 0 0
254 0 $self->{'Output'} .= "$obj $key {\n";
255 0 foreach my $attr ( $self->_order($obj) ) {
256 0 ▶ next unless $self->{'Parsed'}->{$obj}->{$key}->{$attr};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"Parsed"}{$obj}{$key}{$attr} 0 0 0
257 $self->{'Modify'}->{$obj}->{$key}->{$attr}
258 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
259 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
260 'ARRAY' )
261 {
262 0 ▶ if ( @{ $self->{'Modify'}->{$obj}->{$key}->{$attr} }
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self->{'Modify'}{$obj}{$key}{$attr};} > 1) { } 0 0 0
263 > 1 )
264 {
265 0 $self->{'Output'} .= " $attr\n";
266 0 foreach my $val (
267 0 @{ $self->{'Modify'}->{$obj}->{$key}->{$attr}
268 }
269 )
270 {
271 0 $self->{'Output'} .= " $val\n";
272 0 ▶ if ( $self->{'Parsed'}->{$obj}->{$key}
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"Parsed"}{$obj}{$key}{"_xtra"}{$val}) 0 0 0
273 ->{'_xtra'}->{$val} )
274 {
275 $self->{'Output'}
276 .= ' '
277 . $self->{'Parsed'}->{$obj}->{$key}
278 0 ->{'_xtra'}->{$val} . "\n";
279 }
280 }
281 }
282 else {
283 $self->{'Output'}
284 .= " $attr "
285 . $self->{'Modify'}->{$obj}->{$key}
286 0 ->{$attr}[0] . "\n";
287 }
288 }
289 else {
290 $self->{'Output'}
291 .= " $attr "
292 0 . $self->{'Modify'}->{$obj}->{$key}->{$attr}
293 . "\n";
294 }
295 }
296 0 $self->{'Output'} .= "}\n";
297 }
298 else {
299 0 $self->{'Output'} .= $self->{'Raw'}->{$obj}->{$key};
300 }
301 }
302 }
303  
304 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
305 0 print FILE $self->{'Output'};
306 0 close FILE;
307  
308 0 return 1;
309 }
310  
311 # Return an object hash
312 sub _object {
313 0 ▶ my $self = shift;
Subroutine _object: not called CC=4 SCAR=30.0
314 0 my $obj = shift;
315 0 my $var = shift;
316  
317 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
318 0 ▶ return undef unless defined $var;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $var 0 0 0
319 0 ▶ return $self->{'Parsed'}->{$obj}->{$var} || undef;
Condition0%0/2
$self->{'Parsed'}{$obj}{$var} || undef
l!l
00
MC/DC0%0/1
$self->{'Parsed'}{$obj}{$var} || undef
$self->{'Parsed'}{$obj}{$var}
Truth table0%0/2
A
A= $self->{'Parsed'}{$obj}{$var}
Aresult
11
00
320 }
321  
322 # Return a list of objects
323 sub _objectlist {
324 0 ▶ my $self = shift;
Subroutine _objectlist: not called CC=3 SCAR=24.8
325 0 my $obj = shift;
326  
327 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
328  
329 0 ▶ if ( $self->{'Parsed'}->{$obj} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'Parsed'}{$obj}) { } 0 0 0
330 0 return keys %{ $self->{'Parsed'}->{$obj} };
331 }
332 else {
333 0 return 0;
334 }
335 }
336  
337 # Define object attribute ordering
338 sub _order {
339 0 ▶ my $self = shift;
Subroutine _order: not called CC=10 SCAR=47.0
340  
341 0 for (shift) {
342 0 ▶ /auth/ && return qw( bind login search servers service ssl user );
Branch: 1 branch
BranchTrueFalseTotal
/auth/u and return "bind", "login", "search", "servers", "service", "ssl", "user" 0 0 0
343 0 ▶ /gtm monitor/
Branch: 1 branch
BranchTrueFalseTotal
/gtm monitor/u and return "default", "base", "debug", "filter", "mandatoryattrs", "password", "security", "username", "interval", "timeout", "manual", "dest", "recv", "send" 0 0 0
344 && return
345 qw( default base debug filter mandatoryattrs password security username interval timeout manual dest recv send );
346 0 ▶ /gtm node/ && return qw( monitor screen );
Branch: 1 branch
BranchTrueFalseTotal
/gtm node/u and return "monitor", "screen" 0 0 0
347 0 ▶ /gtm pool/ && return qw( lb nat monitor members );
Branch: 1 branch
BranchTrueFalseTotal
/gtm pool/u and return "lb", "nat", "monitor", "members" 0 0 0
348 0 ▶ /partition/ && return qw( description );
Branch: 1 branch
BranchTrueFalseTotal
/partition/u and return "description" 0 0 0
349 0 ▶ /net self/ && return qw( netmask unit floating vlan allow );
Branch: 1 branch
BranchTrueFalseTotal
/net self/u and return "netmask", "unit", "floating", "vlan", "allow" 0 0 0
350 0 ▶ /auth user/
Branch: 1 branch
BranchTrueFalseTotal
/auth user/u and return "password", "description", "id", "group", "home", "shell", "role" 0 0 0
351 && return qw( password description id group home shell role );
352 0 ▶ /gtm server/
Branch: 1 branch
BranchTrueFalseTotal
/gtm server/u and return "translate", "snat", "pool", "destination", "ip", "rules", "profiles", "persist" 0 0 0
353 && return
354 qw( translate snat pool destination ip rules profiles persist );
355  
356 0 return 0;
357 }
358 }
359  
360 # Parse the configuration file
361 sub _parse {
362 0 ▶ my $self = shift;
Subroutine _parse: not called CC=65 SCAR=83.6
363 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
364  
365 die "File not found: $self->{'ConfigFile'}\n"
366 0 ▶ unless -e $self->{'ConfigFile'};
Branch: 1 branch
BranchTrueFalseTotal
unless -e $self->{"ConfigFile"} 0 0 0
367  
368 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
369 0 my @file = <FILE>;
370 0 close FILE;
371  
372 0 my ( $parsed, $obj, $key, $attr1, $attr2, $attr3 );
373  
374 0 ▶ until ( !$file[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (not $file[0]) 0 0 0
375 0 my $ln = shift @file;
376  
377 #policy hit situation with gtm attribute
378 0 ▶ if ( $ln =~ /^(auth user|patition|cli)\s(.*)\s\{(\s\})?$/ ) {
Branch: 7 branches
BranchTrueFalseTotal
if ($ln =~ /^(auth user|patition|cli)\s(.*)\s\{(\s\})?$/u) { } 0 0 0
elsif ($ln =~ /^(gtm wideip|gtm pool|gtm server|gtm region)\s(.*)\s\{(\s\})?$/u) { } 0 0 0
elsif ($ln =~ /^(net self|net route|net interface|net vlan|net trunk)\s(.*)\s\{(\s\})?$/u) { } 0 0 0
elsif ($ln =~ /^(sys management-route)\s(.*)\s\{(\s\})?$/u) { } 0 0 0
elsif ($ln =~ /^((gtm monitor)\s(http|tcp|udp|bigip|gateway_icmp))\s(\S+)\s\{(\s\})?$/u) { } 0 0 0
elsif ($ln =~ /^(sys)\s(snmp|sshd|ntp|syslog|state-mirroring)\s\{(\s\})?$/u) { } 0 0 0
elsif ($ln =~ /^\}$/u) { } 0 0 0
379 0 ▶ next if $3;
Branch: 1 branch
BranchTrueFalseTotal
if $3 0 0 0
380 0 $obj = $1;
381 0 $key = $2;
382 }
383  
384 #gtm attribute
385 elsif ( $ln
386 =~ /^(gtm wideip|gtm pool|gtm server|gtm region)\s(.*)\s\{(\s\})?$/
387 )
388 {
389 0 ▶ next if $3;
Branch: 1 branch
BranchTrueFalseTotal
if $3 0 0 0
390 0 $obj = $1;
391 0 $key = $2;
392 }
393  
394 #net attribute
395 elsif ( $ln
396 =~ /^(net self|net route|net interface|net vlan|net trunk)\s(.*)\s\{(\s\})?$/
397 )
398 {
399 0 ▶ next if $3;
Branch: 1 branch
BranchTrueFalseTotal
if $3 0 0 0
400 0 $obj = $1;
401 0 $key = $2;
402 }
403  
404 #sys attribute
405 elsif ( $ln =~ /^(sys management-route)\s(.*)\s\{(\s\})?$/ ) {
406 0 ▶ next if $3;
Branch: 1 branch
BranchTrueFalseTotal
if $3 0 0 0
407 0 $obj = $1;
408 0 $key = $2;
409 }
410  
411 #gtm monitor attribute
412 elsif ( $ln
413 =~ /^((gtm monitor)\s(http|tcp|udp|bigip|gateway_icmp))\s(\S+)\s\{(\s\})?$/
414 )
415 {
416 0 ▶ next if $5;
Branch: 1 branch
BranchTrueFalseTotal
if $5 0 0 0
417 0 $obj = $2;
418 0 $key = $4;
419 0 ▶ $parsed->{$obj}{$key}{"monitor_method"} = $3 if ( $obj && $key );
Branch: 1 branch
BranchTrueFalseTotal
if $obj and $key 0 0 0
Condition0%0/3
$obj and $key
!ll&&!rl&&r
000
MC/DC0%0/2
$obj and $key
$obj $key
Truth table0%0/3
A and B
A= $objB= $key
ABresult
0X0
100
111
420 }
421  
422 #sys management attribute
423 elsif ( $ln
424 =~ /^(sys)\s(snmp|sshd|ntp|syslog|state-mirroring)\s\{(\s\})?$/ )
425 {
426 0 ▶ next if $3;
Branch: 1 branch
BranchTrueFalseTotal
if $3 0 0 0
427 0 $obj = $1;
428 0 $key = $2;
429 }
430 elsif ( $ln =~ /^\}$/ ) {
431 0 $obj = undef;
432 0 $key = undef;
433 }
434  
435 # mungle data structure
436 0 ▶ if ( $obj && $key ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($obj and $key) 0 0 0
Condition0%0/3
$obj and $key
!ll&&!rl&&r
000
MC/DC0%0/2
$obj and $key
$obj $key
Truth table0%0/3
A and B
A= $objB= $key
ABresult
0X0
100
111
437 0 $self->{'Raw'}->{$obj}{$key} .= $ln;
438  
439 #Indent=4 { not empty }
440 0 ▶ if ( $ln =~ /^\s{4}(\S+|\".*\")\s\{$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{4}(\S+|\".*\")\s\{$/u) 0 0 0
441 0 $attr1 = $1;
442 0 next;
443 }
444  
445 #$intdent=8 { not empty }
446 0 ▶ if ( $ln =~ /^\s{8}(\S+|\".*\")\s\{$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{8}(\S+|\".*\")\s\{$/u) 0 0 0
447 0 $attr2 = $1;
448 0 next;
449 }
450  
451 #$intdent=12 { not empty }
452 0 ▶ if ( $ln =~ /^\s{12}(\S+|\".*\")\s\{$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{12}(\S+|\".*\")\s\{$/u) 0 0 0
453 0 $attr3 = $1;
454 0 next;
455 }
456  
457 #Indent=4 with }$
458 0 ▶ if ( $ln =~ /^\s{4}\}$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{4}\}$/u) 0 0 0
459 0 $attr1 = undef;
460 0 next;
461 }
462  
463 #Indent=8 with }$
464 0 ▶ if ( $ln =~ /^\s{8}\}$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{8}\}$/u) 0 0 0
465 0 $attr2 = undef;
466 0 next;
467 }
468  
469 #Indent=12 with }$
470 0 ▶ if ( $ln =~ /^\s{12}\}$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{12}\}$/u) 0 0 0
471 0 $attr3 = undef;
472 0 next;
473 }
474  
475 #Indent=4 {}
476 0 ▶ if ( $ln =~ /^\s{4}(\S+)\s\{\s\}$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{4}(\S+)\s\{\s\}$/u) 0 0 0
477 0 $parsed->{$obj}{$key}{$1} = undef;
478 0 next;
479 }
480  
481 #Indent=4 { scalar }
482 0 ▶ if ( $ln =~ /^\s{4}(\S+)\s\{(.*)\}$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{4}(\S+)\s\{(.*)\}$/u) 0 0 0
483 0 ▶ $parsed->{$obj}{$key}{$1} ||= [];
Condition0%0/2
$parsed->{$obj}{$key}{$1} ||= []
l!l
00
MC/DC0%0/1
$parsed->{$obj}{$key}{$1} ||= []
$parsed->{$obj}{$key}{$1}
Truth table0%0/2
A
A= $parsed->{$obj}{$key}{$1}
Aresult
11
00
484 0 push @{ $parsed->{$obj}{$key}{$1} },
485 0 grep { not /^\s*$/ } split( /\s+/, $2 );
486 0 next;
487 }
488  
489 0 ▶ if ( defined $attr1 && $attr1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $attr1 and $attr1) 0 0 0
Condition0%0/3
defined $attr1 and $attr1
!ll&&!rl&&r
000
MC/DC0%0/2
defined $attr1 and $attr1
defined $attr1 $attr1
Truth table0%0/3
A and B
A= defined $attr1B= $attr1
ABresult
0X0
100
111
490  
491 #Indent=8 {}
492 0 ▶ if ( $ln =~ /^\s{8}(\S+)\s\{\s\}$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{8}(\S+)\s\{\s\}$/u) 0 0 0
493 0 $parsed->{$obj}{$key}{$attr1}{$1} = undef;
494 0 next;
495 }
496  
497 #Indent=8 { scalar }
498 0 ▶ if ( $ln =~ /^\s{8}(\S+)\s\{(.*)\}$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{8}(\S+)\s\{(.*)\}$/u) 0 0 0
499 0 ▶ $parsed->{$obj}{$key}{$attr1}{$1} ||= [];
Condition0%0/2
$parsed->{$obj}{$key}{$attr1}{$1} ||= []
l!l
00
MC/DC0%0/1
$parsed->{$obj}{$key}{$attr1}{$1} ||= []
$parsed->{$obj}{$key}{$attr1}{$1}
Truth table0%0/2
A
A= $parsed->{$obj}{$key}{$attr1}{$1}
Aresult
11
00
500 0 push @{ $parsed->{$obj}{$key}{$attr1}{$1} },
501 0 grep { not /^\s*$/ } split( /\s+/, $2 );
502 0 next;
503 }
504  
505 #Indent=8 match { key => value }
506 0 ▶ if ( $ln =~ /^\s{8}(\S+)\s(.*)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{8}(\S+)\s(.*)$/u) 0 0 0
507 0 $parsed->{$obj}{$key}{$attr1}{$1} = $2;
508 0 next;
509 }
510  
511 #Indent=8 match scalar
512 0 ▶ if ( $ln =~ /^\s{8}(\S+)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{8}(\S+)$/u) 0 0 0
513 0 ▶ if ( ref( $parsed->{$obj}{$key}{$attr1} ) eq 'HASH' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $parsed->{$obj}{$key}{$attr1} eq 'HASH') { } 0 0 0
514 0 $parsed->{$obj}{$key}{$attr1}{$1} = undef;
515 }
516 else {
517 0 ▶ $parsed->{$obj}{$key}{$attr1} ||= [];
Condition0%0/2
$parsed->{$obj}{$key}{$attr1} ||= []
l!l
00
MC/DC0%0/1
$parsed->{$obj}{$key}{$attr1} ||= []
$parsed->{$obj}{$key}{$attr1}
Truth table0%0/2
A
A= $parsed->{$obj}{$key}{$attr1}
Aresult
11
00
518 0 push @{ $parsed->{$obj}{$key}{$attr1} }, $1;
519 }
520 0 next;
521 }
522 }
523  
524 0 ▶ if ( defined $attr2 && ( $attr1 && $attr2 ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $attr2 and ($attr1 and $attr2)) 0 0 0
Condition0%0/6
defined $attr2 and ($attr1 and $attr2)
!ll&&!rl&&r
000
$attr1 and $attr2
!ll&&!rl&&r
000
MC/DC0%0/3
defined $attr2 and ($attr1 and $attr2)
defined $attr2 $attr1 $attr2
Truth table0%0/4
A and B and C
A= defined $attr2B= $attr1C= $attr2
ABCresult
0XX0
10X0
1100
1111
525  
526 #Indent=12 match { not empty }
527 0 ▶ if ( $ln =~ /^\s{12}(\S+)\s\{\s\}$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{12}(\S+)\s\{\s\}$/u) 0 0 0
528 0 $parsed->{$obj}{$key}{$attr1}{$attr2}{$1} = undef;
529 0 next;
530 }
531  
532 #Indent=12 { scalar }
533 0 ▶ if ( $ln =~ /^\s{12}(\S+)\s\{(.*)\}$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{12}(\S+)\s\{(.*)\}$/u) 0 0 0
534 0 ▶ $parsed->{$obj}{$key}{$attr1} ||= [];
Condition0%0/2
$parsed->{$obj}{$key}{$attr1} ||= []
l!l
00
MC/DC0%0/1
$parsed->{$obj}{$key}{$attr1} ||= []
$parsed->{$obj}{$key}{$attr1}
Truth table0%0/2
A
A= $parsed->{$obj}{$key}{$attr1}
Aresult
11
00
535 0 push @{ $parsed->{$obj}{$key}{$attr1}{$attr2}{$1} },
536 0 grep { not /^\s*$/ } split( /\s+/, $2 );
537 0 next;
538 }
539  
540 #Indent=12 match { key => value }
541 0 ▶ if ( $ln =~ /^\s{12}(\S+)\s(.*)\s?$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{12}(\S+)\s(.*)\s?$/u) 0 0 0
542 0 $parsed->{$obj}->{$key}{$attr1}{$attr2}{$1} = $2;
543 0 next;
544 }
545  
546 #Indent=12 match scalar
547 0 ▶ if ( $ln =~ /^\s{12}(.*)\s?$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{12}(.*)\s?$/u) 0 0 0
548 0 ▶ if (ref( $parsed->{$obj}{$key}{$attr1}{$attr2} ) eq
Branch: 1 branch
BranchTrueFalseTotal
if (ref $parsed->{$obj}{$key}{$attr1}{$attr2} eq 'HASH') { } 0 0 0
549 'HASH' )
550 {
551 0 $parsed->{$obj}{$key}{$attr1}{$attr2}{$1} = undef;
552 }
553 else {
554 0 ▶ $parsed->{$obj}{$key}{$attr1}{$attr2} ||= [];
Condition0%0/2
$parsed->{$obj}{$key}{$attr1}{$attr2} ||= []
l!l
00
MC/DC0%0/1
$parsed->{$obj}{$key}{$attr1}{$attr2} ||= []
$parsed->{$obj}{$key}{$attr1}{$attr2}
Truth table0%0/2
A
A= $parsed->{$obj}{$key}{$attr1}{$attr2}
Aresult
11
00
555 0 push @{ $parsed->{$obj}{$key}{$attr1}{$attr2} }, $1;
556 }
557 0 next;
558 }
559 }
560  
561 0 ▶ if ( defined $attr3 && ( $attr1 && $attr2 && $attr3 ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $attr3 and ($attr1 and $attr2 and $attr3)) 0 0 0
Condition0%0/9
defined $attr3 and ($attr1 and $attr2 and $attr3)
!ll&&!rl&&r
000
$attr1 and $attr2 and $attr3
!ll&&!rl&&r
000
$attr1 and $attr2
!ll&&!rl&&r
000
MC/DC0%0/4
defined $attr3 and ($attr1 and $attr2 and $attr3)
defined $attr3 $attr1 $attr2 $attr3
Truth table0%0/5
A and B and C and D
A= defined $attr3B= $attr1C= $attr2D= $attr3
ABCDresult
0XXX0
10XX0
110X0
11100
11111
562  
563 #Indent=16 match { not empty }
564 0 ▶ if ( $ln =~ /^\s{16}(\S+)\s\{\s\}$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{16}(\S+)\s\{\s\}$/u) 0 0 0
565 0 $parsed->{$obj}{$key}{$attr1}{$attr2}{$attr3}{$1} = undef;
566 0 next;
567 }
568  
569 #Indent=16 { scalar }
570 0 ▶ if ( $ln =~ /^\s{16}(\S+)\s\{(.*)\}$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{16}(\S+)\s\{(.*)\}$/u) 0 0 0
571 0 ▶ $parsed->{$obj}{$key}{$attr1} ||= [];
Condition0%0/2
$parsed->{$obj}{$key}{$attr1} ||= []
l!l
00
MC/DC0%0/1
$parsed->{$obj}{$key}{$attr1} ||= []
$parsed->{$obj}{$key}{$attr1}
Truth table0%0/2
A
A= $parsed->{$obj}{$key}{$attr1}
Aresult
11
00
572 0 push @{ $parsed->{$obj}{$key}{$attr1}{$attr2}{$attr3}{$1}
573 0 }, grep { not /^\s*$/ } split( /\s+/, $2 );
574 0 next;
575 }
576  
577 #Indent=16 match { key => value }
578 0 ▶ if ( $ln =~ /^\s{16}(\S+)\s(.*)\s?$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{16}(\S+)\s(.*)\s?$/u) 0 0 0
579 0 $parsed->{$obj}->{$key}{$attr1}{$attr2}{$attr3}{$1} = $2;
580 0 next;
581 }
582  
583 #Indent=12 match scalar
584 0 ▶ if ( $ln =~ /^\s{16}(.*)\s?$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{16}(.*)\s?$/u) 0 0 0
585 0 ▶ if (ref( $parsed->{$obj}{$key}{$attr1}{$attr2}{$attr3} )
Branch: 1 branch
BranchTrueFalseTotal
if (ref $parsed->{$obj}{$key}{$attr1}{$attr2}{$attr3} eq 'HASH') { } 0 0 0
586 eq 'HASH' )
587 {
588 0 $parsed->{$obj}{$key}{$attr1}{$attr2}{$attr3}{$1}
589 = undef;
590 }
591 else {
592 0 ▶ $parsed->{$obj}{$key}{$attr1}{$attr2}{$attr3} ||= [];
Condition0%0/2
$parsed->{$obj}{$key}{$attr1}{$attr2}{$attr3} ||= []
l!l
00
MC/DC0%0/1
$parsed->{$obj}{$key}{$attr1}{$attr2}{$attr3} ||= []
$parsed->{$obj}{$key}{$attr1}{$attr2}{$attr3}
Truth table0%0/2
A
A= $parsed->{$obj}{$key}{$attr1}{$attr2}{$attr3}
Aresult
11
00
593 0 push @{ $parsed->{$obj}{$key}{$attr1}{$attr2}{$attr3}
594 }, $1;
595 }
596 0 next;
597 }
598 }
599  
600 #Indent=4 match { key => value }
601 0 ▶ if ( $ln =~ /^\s{4}(\S+)\s(.*)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ln =~ /^\s{4}(\S+)\s(.*)$/u) 0 0 0
602 0 $parsed->{$obj}{$key}{$1} = $2;
603 0 next;
604 }
605 }
606 }
607  
608 # Fill in ill-formatted objects
609 0 foreach my $obj ( keys %{ $self->{'Raw'} } ) {
610 0 foreach my $key ( keys %{ $self->{'Raw'}->{$obj} } ) {
611 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
612 }
613 }
614  
615 0 return $parsed;
616 }
617  
618 1 1;
619  
620 __END__
↑ Summary