warriorsf has asked for the wisdom of the Perl Monks concerning the following question:

Hello,
As a part of a software startup test, I need to automate the following:

- Install the new rpm build
- Run a sql script against a database (and parse its output to ensure that no unexpected errors were thrown)
- Run a shell script that is interactive
- Run a perl script that returns some output.
- Parse the output of this perl script to ensure that the expected information is returned.

What is the best way to achieve these tasks sequentially?
Can I use a combination of something like expect (run interactive shell script) and system commands (install rpm etc).
I'm not sure what to do to grep the output of the perl script / run the perl script (system() again?). Are there some perl modules from cpan that you would recommend to use for this task?

I'm feeling slightly overwhelmed and lost...

Thanks!

Replies are listed 'Best First'.
Re: Automating Software Install/Startup
by perlfan (Parson) on Oct 16, 2007 at 19:04 UTC
    I'd manage a shell script that:
    1. installed the rpm
    2. called a separate Perl utility to deal with the DB
    3. run a separate shell script interactively (see below)
    4. run the 2nd Perl utility, though with proper error checking your external utils should simply fail or succeed
    Dealing with an interactive shell script inside using another shell script looks like:
    #!/bin/sh sh ./interactive.sh <<END input string 1 input string 2 ... END
    I would not wrap this into the one Perl script to rule them allz. Utilize the shell script interface and piping/redirect facilities provided by the *nix environment.