removed Carp and changed to error_throw().

This commit is contained in:
Max Baker
2005-02-17 01:45:21 +00:00
parent 0f654f5aaa
commit d38bfcbbf7
2 changed files with 4 additions and 10 deletions

View File

@@ -38,7 +38,6 @@ use strict;
use Exporter; use Exporter;
use SNMP::Info; use SNMP::Info;
use Carp;
@SNMP::Info::CDP::ISA = qw/SNMP::Info Exporter/; @SNMP::Info::CDP::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::CDP::EXPORT_OK = qw//; @SNMP::Info::CDP::EXPORT_OK = qw//;
@@ -125,8 +124,7 @@ sub c_if {
# Nope, didn't think so. Now we fake it. # Nope, didn't think so. Now we fake it.
my $c_ip = $cdp->c_ip(); my $c_ip = $cdp->c_ip();
unless (defined $c_ip){ unless (defined $c_ip){
$cdp->{error} = "SNMP::Info::CDP::c_if() - Device doesn't have c_ip() data. Can't fake c_index()"; $cdp->error_throw("SNMP::Info::CDP:c_if() - Device doesn't have cdp_ip() data. Can't fake cdp_index()");
carp($cdp->error(1)) if $cdp->debug();
return undef; return undef;
} }

View File

@@ -32,18 +32,17 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::FDP; package SNMP::Info::FDP;
$VERSION = 1.0;
use strict; use strict;
use Exporter; use Exporter;
use SNMP::Info; use SNMP::Info;
use Carp;
@SNMP::Info::FDP::ISA = qw/SNMP::Info Exporter/; @SNMP::Info::FDP::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::FDP::EXPORT_OK = qw//; @SNMP::Info::FDP::EXPORT_OK = qw//;
use vars qw/$VERSION $DEBUG %FUNCS %GLOBALS %MIBS %MUNGE $INIT/; use vars qw/$VERSION $DEBUG %FUNCS %GLOBALS %MIBS %MUNGE $INIT/;
$VERSION = 1.0;
%MIBS = ( 'FOUNDRY-SN-SWITCH-GROUP-MIB' => 'snFdpGlobalRun' ); %MIBS = ( 'FOUNDRY-SN-SWITCH-GROUP-MIB' => 'snFdpGlobalRun' );
@@ -70,7 +69,7 @@ use vars qw/$VERSION $DEBUG %FUNCS %GLOBALS %MIBS %MUNGE $INIT/;
'c_capabilities' => 'snFdpCacheCapabilities', 'c_capabilities' => 'snFdpCacheCapabilities',
'c_domain' => 'snFdpCacheVTPMgmtDomain', 'c_domain' => 'snFdpCacheVTPMgmtDomain',
'c_vlan' => 'snFdpCacheNativeVLAN', 'c_vlan' => 'snFdpCacheNativeVLAN',
'c_duplex' => 'snFdpCacheDuplex' 'c_duplex' => 'snFdpCacheDuplex',
); );
%MUNGE = ( %MUNGE = (
@@ -120,8 +119,6 @@ sub hasFDP {
sub c_if { sub c_if {
my $fdp = shift; my $fdp = shift;
# See if by some miracle Cisco implemented the fdpCacheIfIndex entry # See if by some miracle Cisco implemented the fdpCacheIfIndex entry
my $fdp_index = $fdp->fdp_index(); my $fdp_index = $fdp->fdp_index();
return $fdp_index if defined $fdp_index; return $fdp_index if defined $fdp_index;
@@ -129,8 +126,7 @@ sub c_if {
# Nope, didn't think so. Now we fake it. # Nope, didn't think so. Now we fake it.
my $fdp_ip = $fdp->c_ip(); my $fdp_ip = $fdp->c_ip();
unless (defined $fdp_ip){ unless (defined $fdp_ip){
$fdp->{error} = "SNMP::Info::FDP:fdp_if() - Device doesn't have fdp_ip() data. Can't fake fdp_index()"; $fdp->error_throw("SNMP::Info::FDP:fdp_if() - Device doesn't have fdp_ip() data. Can't fake fdp_index()");
carp($fdp->error(1)) if $fdp->debug();
return undef; return undef;
} }