mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-02 11:48:03 +00:00
refines use of truthy values for Json true/false values
This commit is contained in:
@@ -65,8 +65,10 @@ $uri = "/port/1/${des_resource}/list?fields=alias,device,down,phantom,port";
|
||||
$rh = json_request($uri);
|
||||
flatten_list($rh, 'interfaces');
|
||||
for my $rh_p (keys %{$rh->{'flat_list'}}) {
|
||||
print " down? $rh->{'flat_list'}->{$rh_p}->{'down'} ";
|
||||
if ($rh->{'flat_list'}->{$rh_p}->{'down'} eq "false") {
|
||||
# truthy value evaluates better
|
||||
my $onoff = $rh->{'flat_list'}->{$rh_p}->{'down'};
|
||||
print "$rh_p down? $onoff ";
|
||||
if ($onoff) {
|
||||
push(@ports_up, $rh_p);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user