App::PerlWatcher::Watcher::GenericExecutor - Watches for the output of execution of arbitrary command.
version 0.20
# 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/ } @_ }, ], } }
The command (executable) regularry been executed, e.g. /bin/ls
The array of arguments, givent to the command, e.g. ["/tmp"]. Default value is an empty array
How often the external command will be executed (in seconds). Default value is 600 seconds (10 mins).
The maximum execution time of the command in seconds. Default value 10 seconds.
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.
The closure which is been applied to each line of filtered output to add/strip something. Defaut value: just return the unchanged line
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'.
That closure actully processes the output from command and invokes actual callback with Status and EventItems
Currently, to execute the external program and capture it's output the IPC::Cmd::run is used. Unfortunatly, due to limitations of alarm function implementation on Windows.
May be there would be some Windows guy, who will implement that via Win32::Job?
Ivan Baidakou <dmol@gmx.com>
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.
To install App::PerlWatcher::Engine, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::PerlWatcher::Engine
CPAN shell
perl -MCPAN -e shell install App::PerlWatcher::Engine
For more information on module installation, please visit the detailed CPAN module installation guide.