in reply to Re^2: Problems with the module Net::SNMP
in thread Problems with the module Net::SNMP

Line 21 is this line:

my $result = $session->get_next_request ( varbindlist => [ $param{sysN +ame}.$1] ); die "request error: ".$session->error unless ( defined $r +esult );

The reason that your program breaks is that it directly calls "die" which brings the script to an immediate end... see die for the details. I think that if you change it to "warn" or even a plain "print" it will do what you are looking for. For similar reasons, you will also need to change

unless ( $param{sysName} =~ /$param{sysName}(.*)/ ) {last}

on the next line to

unless ( $param{sysName} =~ /$param{sysName}(.*)/ ) {next}

since the "last" will exit the loop so no more ip's will be tried.

Replies are listed 'Best First'.
Re^4: Problems with the module Net::SNMP
by tolyan77 (Novice) on Nov 08, 2006 at 10:46 UTC
    if (!defined($session)) { printf("ERROR: %s.\n", $error); exit 1; }
    I thought the programm must stop on this line?
      Oops, sorry... yes, you need to change "exit 1" on this line to "next" so the program will continue in this case too.