Qiang has asked for the wisdom of the Perl Monks concerning the following question:
in the foreachloop, only the first loop times out within the eval block. the rest of loops takes less than 5 seconds to finish. however, after the first loop, $result->{$oid} is always empty. which isn't if i take out of the eval block. any idea ?sub fun1 { foreach (printers ){ my ($session, $error) = Net::SNMP->session( -hostname => $ip, -community => chomp($cmnt), -port => 161, -timeout => 5, ); my $result = $session->get_request( -varbindlist => [$OID] ); eval { local $SIG{ALRM} = sub { die "alarm\n" }; alarm 5; $result = $session->get_request( -varbindlist => [$oid] ); alarm 0; }; $row .= lc($result->{$oid})."-"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: eval alarm on mod_perl
by Roger (Parson) on Feb 18, 2004 at 07:15 UTC | |
by Qiang (Friar) on Feb 18, 2004 at 08:09 UTC | |
|
Re: eval alarm on mod_perl
by simonm (Vicar) on Feb 18, 2004 at 19:37 UTC |