Avoid Perl warnings in Info::CiscoStack

These two points in CiscoStack use a value from a hash in a numerical
comparison without verifying they exist.  If they don't, Perl warnings get
emitted.  Instead, we check for existence first, then compare the value.
This commit is contained in:
Brian De Wolf
2011-06-23 13:51:43 -07:00
parent 631010ed3f
commit a54b446dae

View File

@@ -159,7 +159,7 @@ sub i_duplex {
next if ( defined $partial and $iid !~ /^$partial$/ );
# Test for gigabit
if ( $p_duplex_cap->{$port} == 0 ) {
if ( $p_duplex_cap->{$port} && $p_duplex_cap->{$port} == 0 ) {
$i_duplex->{$iid} = 'full';
}
@@ -194,7 +194,7 @@ sub i_duplex_admin {
next if ( defined $partial and $iid !~ /^$partial$/ );
# Test for gigabit
if ( $p_duplex_cap->{$port} == 0 ) {
if ( $p_duplex_cap->{$port} && $p_duplex_cap->{$port} == 1 ) {
$i_duplex_admin->{$iid} = 'full';
}