Maybe I'm completely confused, but what I had understood that you wanted was something like the following:

  1. loadrunner is writing to an output file as it runs (say output.log)
  2. your program reads from output.log looking for interesting results.

Normally the difficult part of this is getting the second program to continue reading when new data is written to the file. That is what File::Tail helps with.

Now it sounds like you have a few other issues to consider.

  1. some form of logging requirement
  2. notify you on interesting events
  3. requirement to check if requests take too long

I can't tell if you need the logging in its own right, or if you just need it for the notification. If you just need the notifications, there are many methods that can be used (email, Log::Log4perl, flashing lights, etc.). If you need the log itself, then either writing to a file directly or one of the logging modules on CPAN would work.

Checking to see if a process is taking too long is could be handled with a timeout on the read. File::Tail can handle this using the maxinterval parameter. If File::Tail doesn't suit your needs, you could wrap the read in an eval and use the alarm function to make certain you don't wait too long. (If you time out, you can notify and loop back to wait some more.)

At this point, it would probably be worthwhile to try to write down (possibly just for yourself) the process you are trying to implement. From this end, it looks a bit fuzzy. Possibly writing out the events you are looking for and how you want to handle them would help. Then, some of the techniques I've mentioned may make more sense.

G. Wade

In reply to Re^5: processing file while file is in use by gwadej
in thread processing file while file is in use by grashoper

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.