Owners Manual
Perl Scripts | Actions and Adaptive CLI
590 OMNM 6.5.2 User Guide
Perl Scripts
This section describes the details of using Perl scripts within Adaptive CLI. See
Using Perl in
Adaptive CLI
on page 557 for more about why to use Perl.
The Perl output goes to the selected target device. Typically, this means creating lines like the
following:
println(“show $param”);
or
print(“show $param\n”);
You must specify parameters within the script (like
$param
) in the screen described in
Attributes
on page 565. Unlike its internal scripts, Adaptive CLI does not automatically create attributes. You
must also manually configure created attributes to be
Mandatory,
or
Optional
in that screen.
A few things to remember when using Perl:
• The normal output of your Perl scripts (to stdout) are the commands sent to a device by this
application.
• If your script produces an error message (to stderr), the job fails with that message and all
script outputs are ignored. You can validate a script before sending any command to the
device by using die(...) and warn(...) functions in Perl to produce error messages to stderr.
Such messages trigger the script’s failure.
• For such scripts to operate correctly, you must have Perl installed on the directory path for all
OpenManage Network Manager servers.
• Perl may not come with OpenManage Network Manager and must be on the server system for
it to work with Adaptive CLI.
• You can install your version of Perl and set the PATH environment variable accordingly so that
one can run
perl -v
from the command line (where the OpenManage Network Manager
server is to be started). Adaptive CLI invokes that same
perl
command.
If for some reason Adaptive CLI, fails to invoke the default
perl
command, it reads the
setting of
activeconfig.perl.exe=...
inside
owareapps/activeconfig/lib/
ac.properties
, and uses that alternative command.
Note that the default
activeconfig.perl.prefix=
setting in
ac.properties
is
prepended to every Perl script. It basically forces the script to
use strict
mode and
provides a convenient
println
method for the user. Knowledgeable Perl users can change
this default behavior setting but should be careful about it. Remember, best practice is to
override properties as described in
Overriding Properties
on page 111.
• The standard output (using
println
) of the Adaptive CLI Perl script represents the
command set that is to be sent to the device. For convenience, a
println
subroutine is
embedded with the script.
• Adaptive CLI with Perl scripts must contain valid Perl under the “strict” pragma (
use
strict;
). If you import or migrate from a previous version a Perl script that does not pass
this “strict” criterion, you must rewrite it for “strict” compliance before it can be successfully
edited or copied.
NOTE:
When you import a Perl Adaptive CLI that doesn't pass strict, you can execute it without problems.
However, you cannot edit it at all, unless you first edit it to pass strict (or it won't even let you save the
changes).
The following
Perl Example
may be of interest.