VBTK::Actions - Action definitions used by the VBTK::Server daemon
# Action to run a script on the command line $t = new VBTK::Actions ( Name => 'runScript', Execute => '/usr/local/bin/myscript', LimitToEvery => '10 min', SendUrl => 1, ); # Group action, triggers other actions $s = new VBTK::Actions ( Name => 'group1', SubActionList => 'runScript,emailMe', );
The VBTK::Actions class is used to define actions to be taken by the VBTK::Server daemon. It can be used to Execute commands on the command line or to create a grouping of sub-actions. To add new action types, just sub-class off this class, overriding the 'run' method. See the VBTK::Actions::Email class for an example of this.
The following methods are supported
The allows parameters are:
A unique string identifying this action. This still will be used in lists of 'StatusChangeActions' passed to the VBTK::Server daemon. See "item_StatusChangeActions" in VBTK::Server and "item_StatusChangeActions" in VBTK::Parser for details on where you'll be specifying these names.
Name => 'runScript',
A string to be executed on the command line when the action is triggered. A message will be passed in to the script on STDIN containing details about which objects caused the action to be triggered.
Execute => '/usr/local/bin/myscript'
A time expression used to limit the number of times the action can be triggered within a window of time. The expression will be evaluated by the Date::Manip class, so it can be just about any recognizable time or date expression. For example: '10 min' or '1 day'. (Defaults to '2 min').
LimitToEvery => '2 min',
A boolean value (0 or 1) indicating whether a one-click URL should be passed in the action message which will allow the user to jump directly to the object history entry which caused the action to be triggered. Typically you would always leave this on, unless you're sending messages to a pager or some other device where you wanted to keep the messages as short as possible.
SendUrl => 1,
A string containing a comma-separated list of action names which should be triggered whenever this action is triggered. This allows the creation of action groups which both send email, and also trigger other actions.
SubActionList => 'emailBob,pageDave,killPete',
A boolean value (0 or 1) indicating whether triggering this action should cause an entry to be added to the system action log. (Not yet implemented).
LogActionFlag => 0,
The following sub-classes were created to provide common defaults in the use of VBTK::Actions objects.
Sending an email as an action.
Sending an email to a pager as an action
Others are sure to follow. If you're interested in adding your own sub-class, just copy and modify some of the existing ones. Eventually, I'll get around to documenting this better.
Brent Henry, vbtoolkit@yahoo.com
Copyright (C) 1996-2002 Brent Henry
This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation available at: http://www.gnu.org/copyleft/gpl.html
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
To install VBTK, copy and paste the appropriate command in to your terminal.
cpanm
cpanm VBTK
CPAN shell
perl -MCPAN -e shell install VBTK
For more information on module installation, please visit the detailed CPAN module installation guide.