NAME
App::PerlWatcher::Watcher::GenericExecutor - Watches for the output of execution of arbitrary command.
VERSION
version 0.18
SYNOPSIS
# use the following config for Engine:
{
class => 'App::PerlWatcher::Watcher::GenericExecutor',
config => {
command => "/bin/ls",
arguments => ["-1a", "/tmp/"],
frequency => 60,
timeout => 5,
# filtering "." and ".." files
filter => sub { ($_ !~ /^\.{1,2}$/) && (/\S+/) },
rules => [
# rise warning if strange_file if found among files
# don't forget to use List::MoreUtils qw/any/;
# in the beggining of the config
warn => sub { any { /strange_file.txt/ } @_ },
],
}
}
ATTRIBUTES
command
The command (executable) regularry been executed, e.g. /bin/ls
arguments
The array of arguments, givent to the command, e.g. ["/tmp"]. Default value is an empty array
frequency
How often the external command will be executed (in seconds). Default value is 600 seconds (10 mins).
timeout
The maximum execution time of the command in seconds. Default value 10 seconds.
filter
The closure, which returns true if the current line of command output should be displayed. Default value: always return true, which means to dispay all command's output. The current line is localized to $_ variable.
beautifyer
The closure which is been applied to each line of filtered output to add/strip something. Defaut value: just return the unchanged line
rules
The list, consisting of level and rule of it. If rule returns true a status with that level will be emitted, and no other rules will be evaluated.
Each rule is an closure, wich takes an list of output lines, and returns true if the rule should be applied.
Default value: empty list of rules.
If no is applied, the default status level is 'notice'.
callback_proxy
That closure actully processes the output from command and invokes actual callback with Status and EventItems
AUTHOR
Ivan Baidakou <dmol@gmx.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Ivan Baidakou.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.