Zoidberg::Monitor
The monitor subsystem can be used for running applets inside the zoid. These applets have the following properties:
- name:
-
Unique name used to identify the applet
- event:
-
The event used to trigger the applet
- condition:
-
A subroutine which does arbitrary voodoo to decide whether to return true
- action:
-
A subroutine that acts when the condition is true (notify user, kill process, turn off lights :) )
To get a list of running applets type: ->Monitor->list
You can register a new applet using the following syntax: ->Monitor->add_applet("foo", "bar" , sub1, sub2)
"foo" a name "bar" a event sub1 the condition as perl code sub2 the action as perl code
For example: ->Monitor->add_applet('motz', 'precmd', 'int(rand 6) ? 0: 1', '$_[0]->parent->motz->fortune')
Or delete an applet: ->Monitor->delete_applet("foo")