Designing and Managing Behavior Models - Using Polls - Writing a Poll Condition - Using the Pop-Up Menu for Perl -
Previous: Functions for Use in Poll Conditions     Next: Examples of Poll Conditions

Using the Pop-Up Menu for Perl

There are five different tasks in NerveCenter that require you to write Perl code:

For each of these tasks, you can use not only Perl 5, but some NerveCenter functions and variables that are appropriate to the task. For instance, if you're writing a trap mask trigger function, you can use NerveCenter functions to retrieve information about the variable bindings in the trap that caused the trigger function to be called. You can also use NerveCenter variables that contain information about the contents of the trap.

What functions and variables are available to you depends on the task you're performing. Therefore, NerveCenter provides a pop-up menu in the editing area for each task that indicates which functions and variables are applicable in that situation. The figure below shows the pop-up menu as it appears in the editing area used to create a trap mask trigger function.

Pop-Up Menu for Perl

popUpHelp.gif

The submenu being displayed lists all the variable-binding functions.

Besides serving as documentation, these pop-up menus enable you to enter text in an editing area at the point of the cursor. For example, if you were working in the trigger-function window shown above, selecting the menu entry VbValue would cause the characters "VbValue( " to be written to the editing area.

To make this discussion more concrete, let's look at an example. Let's say that you want to write the following trigger function:


   if ($NodeName ne "troublemaker") {
FireTrigger("gotIt");
}

 
  To write this trigger function, you would:

  1. Open the Mask Definition window, and go tho the Trigger Function page.
  2. Left-click in the Trigger Function editing area, and type if (.
  3. Press the right mouse button, select the Trap variables submenu, and select $NodeName from that submenu.
  4. Press the right mouse, select the Relational operators submenu, and select ne from that submenu.
  5. Type "troublemaker") {; then, enter a new line and four spaces.
  6. Press the right mouse button, select the Other functions submenu, and select FireTrigger from that submenu.
  7. Type in the remainder of the trigger function.


Previous: Functions for Use in Poll Conditions Next: Examples of Poll Conditions
Please send comments or corrections to Information Development
This file was last updated on 10 October 2000