Designing and Managing Behavior Models
-
Using Polls - Writing a Poll Condition - 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.
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:
if (
.
Trap variables
submenu, and select $NodeName
from that submenu.
Relational operators
submenu, and select ne
from that submenu.
"troublemaker") {
; then, enter a new line and four spaces.
Other functions
submenu, and select FireTrigger
from that submenu.
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 |