Create and initialize a RIV::App object

This section of the SNMP GET access example Perl script creates and initializes a new RIV::App object. Use this part of the example script as a guide to creating and initializing new RIV::App objects in client/server Perl scripts that retrieve SNMP information.

The SNMP GET access example Perl script creates and initializes a new RIV::App object as follows:


 my $app = new RIV::App($param, "ncp_test:snmp") or  1 

 die "Can't create RIV application session" unless (defined $app);  2 

The following list explains specific numbered items in the previously listed section of the SNMP GET access Perl script example:

  1. Creates and initializes a new RIV::App object by calling the RIV::App constructor. This call to the RIV::App constructor takes the following parameters:
    • RIV::Param — Specifies a reference to a RIV::Param object. In this example, the newly created RIV::Param object is returned to the my $param variable in a previous call to the RIV::Param constructor.
    • $progname — Specifies a string that uniquely identifies an application. In this example, the application name is identified by the string ncp_test:snmp.
  2. If the constructor fails to create and initialize the new RIV::App object, consider this a fatal error and call the die function. The die function prints out an appropriate message (in this case, that the RIV::App constructor failed) to the standard error stream.