On 14 September 2011 18:30, Jon Jon <[email protected]> wrote:
> my ($handler, $registration_info, $request_info, $requests) = @_;
>
> my $this_request = $request->next();
> When run I get the following error:
> Can't call method "next" on an undefined value at
> /root/snmp_monitor/trunk/SNMPMonitor/Plugin/Atest.pm line 24.
That sounds right.
The handler routine is passed a variable that you have called
'requests' (plural)
but you are trying to dereference a variable called 'request' (singular)
This second variable has not been initialised, so will indeed be undefined.
The normal code framework would look something like
my ($handler, $registration_info, $request_info, $requests) = @_;
for ( $this_request = $requests; $this_request;
$this_request=$this_request->next()) {
# do something with $this_request
}
to handle the possibility of being passed several varbinds to process in one go.
Your example code looks to be trying to set a value for the *second* varbind
in the request list, which will obviously fail if there is only one
(the most common case)
Dave
------------------------------------------------------------------------------
Doing More with Less: The Next Generation Virtual Desktop
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops? How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users