Declare Perl API modules and variables
This section of the SNMP GET access example Perl script declares the Perl API modules to be used as well as a number of variables. Use this part of the example script as a guide to setting up client/server Perl scripts that will retrieve SNMP information.
The SNMP GET access example Perl script declares the Perl API modules to be used and a number of variables as follows:
#!$NCHOME/bin/ncp_perl
use strict; 1
use RIV;
use RIV::Param;
use RIV::App;
use RIV::SnmpAccess; # qw (RivSnmpResultOk); 2
$RIV::SnmpAccess::MaxAsyncConcurrent = 40; 3
my $Ttype = "TEST"; 4
my $Verbose;
my @_Usage = ("node" [async]);
The following list explains specific numbered items in the previously listed section of the SNMP GET access Perl script example:
- Declares the
strictpragma with theusedirective. Thestrictpragma enforces good programming practices, including enforcing the declarations of any new variables withmy. - Specify the
usedirective to declare the Perl API modules to be used. In this case, use theRIV,RIV::Param,RIV::App, andRIV::SnmpAccessmodules. - Sets the MaxAsyncConcurrent
RIV::SnmpAccessmodule variable to the value 40. This module variable sets the maximum number of concurrent asynchronous SNMP get requests. - Declare the following
myvariables:- $Ttype — Stores a string that identifies
whether the SNMP GET access is synchronous or asynchronous. Later
sections of the SNMP GET access example script use this variable in
calls to the
printoperator. The variable gets set initially to the stringTEST. - $Verbose — Specifies how the script progress
details are to be displayed. The
-voption displays verbose progress details. This variable is defined with theRIV::Parammodule, specifically with theUsagemethod. - @_Usage — Specifies the usage string
suffixes
nodeandasync.
- $Ttype — Stores a string that identifies
whether the SNMP GET access is synchronous or asynchronous. Later
sections of the SNMP GET access example script use this variable in
calls to the