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

I have a 3rd party application that I want to invoke, probably using backticks, from a Perl script. the application rights logs files for each command that is used to invoke the application.

In my Perl script I want to monitor the log file during the command execution and capture the output.

Is there a module for this? I see the steps in my Perl script as:

1. Start log file monitor.
2. Invoke 3rd party application.
3. wait for command to end.
4. stop log file monitor
5. write "new" data written to the log file when after step 1 above.

Replies are listed 'Best First'.
Re: in script log file monitor
by ikegami (Patriarch) on Apr 25, 2009 at 03:19 UTC
    How about:
    1. Get current size of log file file. (tell)
    2. Invoke 3rd party application and wait for it to end. (system)
    3. Seek to old end of log file. (seek)
    4. Output data written to the log file since the first step. (print $fh_out $_ while <$fh_in>;)