Once the script has registered as an observer, and subscribed to the notifications of interest, it then proceeds to listen for events and process them as required. The event reception method call is receiveEvent(). This returns an array of up to five values.
For the purposes of the descriptions that follow, assume that events are returned in the array @event, as shown in the following script fragment:
@event = $observer->receiveEvent( );
Should the script require the event to be a single string with a separator used to delimit the fields, in the style of the ASL language, then the application can use the standard Perl join function:
$fs = "|"; $event = join( $fs, $observer->receiveEvent( ) );
The receiveEvent() method can take an optional parameter to specify a timeout in seconds, which may be fractional. If no event arrives within the specified time, a pseudo-event of type TIMEOUT is returned. For example,
@event = $observer->receiveEvent( 0.25 );
If no timeout is specified, the call waits forever.
The first element of the @event array, accessed by using the Perl syntax: $event, contains the event's timestamp measured by using normal UNIX time_t semantics (number of seconds since midnight January 1, 1970).
The second element of the @event array, $event, contains a text string that describes the type of event received.
The array elements from $event to $event[$#event] have meanings that depend on the semantics of the event type given in $event.