I haven't tried POE myself yet, but on following merlyn's link, it looks like something that would be very good to try.

But if, for some odd reason, you wanted to consider some other approach, the next thing I would consider (if I were in your position) would be to create a separate script that fetches and prints log info, with the ability to control source and output format (and perhaps timing as well) based on command-line params, and run that via a pipeline "open()" for each log activity being requested -- something like (untested):

my @loggers; # array of file handles my @logpids; # array of pids for open file handles ... # in branch of case statement for starting a new logger: my $args = "whatever is appropriate..."; my $pid = open( $loggers[@loggers], "logger_script $args |" ) or die "can't run logger_script: $!" ); push @logpids, $pid; ...
The other part of the trick would be to manipulate each file handle (as well as STDIN) to allow for non-blocking i/o, which means that a read will return data if there is any, and will return immediately with no data if there is none available. Check the IO::Handle man page for info on non-blocking i/o (IO::Handle is part of the perl core distro). You may also want to look at the multi-arg usage of the "select" function -- see "perldoc -f select".

The person doing the interaction can request that logs be turned off at any time -- just close the associated file handle to stop the chosen process.


In reply to Re: Event timing and input processing by graff
in thread Event timing and input processing by thekestrel

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.