Designing and Managing Behavior Models - Alarm Actions - Perl Subroutine - Defining a Perl Subroutine -
Previous: Perl Subroutine     Next: Functions for Use in Perl Subroutines

Defining a Perl Subroutine

Before you can add a Perl subroutine to a transition, you must write it (obviously) and store a compiled version of it in the NerveCenter database.

 
  To define a Perl subroutine within NerveCenter:

  1. perlSubShaded.gif From the Admin menu in the main client window, choose Perl Subroutine List.

    The Perl Subroutine List window appears.

    Perl Subroutine List Window

    perlSubroutineList.gif

    This window contains a list with an entry for each Perl subroutine defined in your NerveCenter database. The Compiled Status column indicates whether the subroutine has been successfully compiled. From this window, you can add a new subroutine, modify an existing subroutine, or view the notes for a subroutine.

  2. To add a new subroutine to NerveCenter, select the New button.

    The Perl Subroutine Definition window appears.

    Perl Subroutine Definition Window

    perlSubroutineDefinition.gif

    This window enables you to name and define a new Perl subroutine.

  3. Type the name of your new Perl subroutine in the Name field.
  4. To document your Perl subroutine, select the Notes button, enter a description in the Perl Subroutine Notes window, and select the OK button in that window.
  5. Type your Perl subroutine in the Subroutine text entry box.

    Use Perl version 5 to write your subroutine. You can also make use of the NerveCenter functions and variables discussed in the sections Functions for Use in Perl Subroutines and NerveCenter Variables

    If you right-click in the Perl-subroutine editing area, you'll see a pop-up menu that lists all the functions and variables available for writing Perl subroutines. For more information about this pop-up menu, see the section Using the Pop-Up Menu for Perl.

  6. Select the Save button in the Perl Subroutine Definition window.

    NerveCenter automatically attempts to compile the subroutine. If your Perl subroutine does not compile correctly, NerveCenter displays an error message from the Perl compiler. It also saves the subroutine and places it in the Perl Subroutine List, with the Compiled Status listed as Not Compiled.

    If your Perl subroutine compiles successfully, the saved subroutine is available for use in a Perl Subroutine alarm action. It won't be executed unless it's made the object of a Perl Subroutine action and the associated alarm transition occurs.


Previous: Perl Subroutine Next: Functions for Use in Perl Subroutines
Please send comments or corrections to Information Development
This file was last updated on 10 October © 2002