refines use of truthy values for Json true/false values

This commit is contained in:
Jed Reynolds
2018-10-23 22:54:45 -07:00
parent b176608400
commit 9dfb2574fb
3 changed files with 47 additions and 15 deletions

View File

@@ -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);
}
}