Perl Module Idea

2002-07-03 Thread Mark D. Roth

I asked about this on comp.lang.perl.modules, but I didn't get any
useful responses, so I figured I'd try here.

I'm looking for a simple, lightweight perl module to do intelligent
handling of command output for automated system maintenance scripts
that run out of cron.  In particular, I'd like it to unconditionally
save the output of each command to a log file, but also to be able to
do other things with the output based on arbitrary criteria.  The most
common use would be to email a copy of the output to a specific email
address if the command exits with a non-zero return code.

I didn't see anything similar to this in the perl module list, but I
might have missed something.  If a module already exists to do this,
please point me at it and disregard the rest of this note. ;)

Assuming that no such module currently exists, I'll probably write one
myself.  If I do, should I contribute it to CPAN?  I was surprised by
the lack of responses on c.l.p.m, but this seems like the sort of
thing that other people would find useful, so I'm not sure if it's an
appropriate contribution or not.

Also, I'm not sure what name to use for the module.  Whether or not I
contribute it to CPAN, I'd like to use a name that doesn't
unnecessarily pollute perl's namespace.  The two ideas that I've come
up with are:

   AutoJob
   Batch::Output

I'd like to know what you think about these ideas, or if you have
other suggestions.

Thanks in advance for any information!

-- 
Mark D. Roth <[EMAIL PROTECTED]>  CITES Production Systems Group
http://www.uiuc.edu/ph/www/roth   University of Illinois at Urbana-Champaign



Re: Perl Module Idea

2002-07-03 Thread Mark D. Roth

On Wed Jul 03 22:59 2002 +0100, Tim Bunce wrote:
> There are already modules for
>   launching sub-processes and capture stdout and stderr
>   managing and writing to log files
>   sending email

I definitely agree that it would be a bad idea to reinvent
functionality that's already provided by existing modules.  I was
planning to use Proc::Spawn and Mail::Send for running commands and
sending mail, and I need to do more research to determine if any of
the existing logging modules will do what I need.


> What's you've described sounds like could be done with those and
> just a few lines of code.

I think it would be more than just a few lines of code, especially
once the module starts supporting arbitrary output handling using
arbitrary criteria.  Here are a few examples of what the module would
allow you to do:

  * If the command output contains a specific regex, pipe it to
another program.

  * If the command gets killed with SIGSEGV, page someone.

  * Send email to different people based on regexps in the command
output.

Anyway, if the consensus is still that there's no point in
contributing this module, that's fine with me.  However, I'd still
appreciate feedback on what to call it, even if we'll only be using it
locally.

Thanks for the input!

-- 
Mark D. Roth <[EMAIL PROTECTED]>  CITES Production Systems Group
http://www.uiuc.edu/ph/www/roth   University of Illinois at Urbana-Champaign