package MyCompany::Result::WatchString; use base qw/DBIx::Class::Result/; use strict; __PACKAGE__->table('tblWatchString'); __PACKAGE__->add_columns( 'id', { data_type => 'int', is_auto_increment => 1 }, 'comment', { data_type => 'varchar', size => 30 }, # Appears in logging messages 'log_level', { data_type => 'int', }, # Log4perl log level. 'match_string', { data_type => 'varchar', size => 200 }, # String in the VLC output to match on. ); sub match_re { my $self = shift; my $match_string = $self->match_string; my $matcher = qr/\Q$match_string\E/; return $matcher; } #### my $logger = Log::Log4perl->get_logger(); open INPUT, '-|', '/some/program/with/verbose/output'; while( my $line ) { foreach my $watch_string ( $schema->resultset('WatchString')->all ) { if( $line =~ $watch_string->match_re() ) { # Do stuff my $log_message = join(' ', 'Interesting output '. $watch_string->comment, $line); $logger->log( $watch_string->log_level, $log_message); } } }