Using the following code, is there any way that I can make it open a new xterm for each log file?
my %logs_to_watch = ( cron => "/var/log/cron", mail => "/var/log/maillog", ppp => "/var/log/ppp.log", httpd => "/var/log/httpd-access.log", msg => "/var/log/messages", ); # Start a session to watch the logs. POE::Session->create ( inline_states => { _start => \&begin_watchers, # Handle records from each log differently. cron_record => \&cron_got_record, mail_record => \&mail_got_record, ppp_record => \&ppp_got_record, httpd_record => \&httpd_got_record, msg_record => \&msg_got_record, # Handle log resets and errors the same way for each file. log_reset => \&generic_log_reset, log_error => \&generic_log_error, } ); =for cookbook Start log watchers. Scans the hash of %logs_to_watch, creating a new FollowTail wheel to watch each. Each watcher emits an event based on its key in %logs_to_watch. Those events are handled by functions that will parse, filter, and if necessary display information about the records. For example, cron is the key for "/var/log/cron". The cron log watcher will emit a "cron_record" event whenever that file extends. The POE::Session->create() call above associates the "cron_record" event with the cron_got_record() function later on. =cut sub begin_watchers { my $heap = $_[HEAP]; while ( my ( $service, $log_file ) = each %logs_to_watch ) { my $log_watcher = POE::Wheel::FollowTail->new ( Filename => $log_file, InputEvent => $service . "_record", ResetEvent => "log_reset", ErrorEvent => "log_error", ); $heap->{services}->{ $log_watcher->ID } = $service; $heap->{watchers}->{ $log_watcher->ID } = $log_watcher; } }

In reply to Re^3: POE::FollowTail and xterm by wishartz
in thread POE::FollowTail and xterm by wishartz

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.