The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

VBTK::Actions - Action definitions used by the VBTK::Server daemon

SYNOPSIS

  # 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',
  );

DESCRIPTION

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.

METHODS

The following methods are supported

$s = new VBTK::Actions (<parm1> => <val1>, <parm2> => <val2>, ...)

The allows parameters are:

Name

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',
Execute

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'
LimitToEvery

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',
SendUrl

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,
SubActionList

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',
LogActionFlag

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,

SUB-CLASSES

The following sub-classes were created to provide common defaults in the use of VBTK::Actions objects.

VBTK::Actions::Email

Sending an email as an action.

VBTK::Actions::Email::Page

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.

SEE ALSO

VBTK::Server
VBTK::Parser
VBTK::Actions::Email
VBTK::Actions::Email::Page

AUTHOR

Brent Henry, vbtoolkit@yahoo.com

COPYRIGHT

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.