POE::Session->create( inline_states => { _start => sub { $_[HEAP]{tailor} = POE::Wheel::FollowTail->new( Filename => "$SEARCH_LOG", InputEvent => "got_log_line", ResetEvent => "got_log_rollover", ); }, got_log_line => sub { my $line = $_[ARG0]; LogIt("Read line: $line"); return unless ( $line =~ /$STRING/ ); LogIt("That Line MATCHES SEARCH STRING: '$STRING'\n"); lock($occurred); $occurred++; LogIt("$line"); LogIt("Increasing OCCURRED flag to '$occurred'"); }, got_log_rollover => sub { LogIt("Log rolled over.\n"); }, } );