Loading

DADA::App::LogSearch

NAME

DADA::App::LogSearch - Simple Searching of PlainText Logs for Dada Mail

VERSION

Refer to the version of Dada Mail that this module comes in.

SYNOPSIS

 my $query     = 'find me'; 
 my $searcher  = DADA::App::LogSearch->new; 
 
 my $results   = $searcher->search({
        -query => $query,
        -files => ['/home/account/dada_files/logs/dada_usage.txt'], 
 
 }); 

DESCRIPTION

This module provides a very simple interface to find a term in a list of files that you supply.

SUBROUTINES/METHODS

new

Takes no arguments. Returns a DADA::App::LogSearch object.

Takes two arguments - both are required. They are:

This method will return a hashref. The key of the hashref is the name of the log file that you gave. Each value of the hashref is an arrayfref that holds the lines that match your query.

html_highlight_line

Takes two arguments - both are required -

They are:

Example

Here's an example of how this object can be used:

  use DADA::App::LogSearch
  my $query     = 'find me'; 
  
  my $searcher  = DADA::App::LogSearch->new; 
 
  my $results   = $searcher->search({
        -query => $query,
        -files => [
                   '/home/account/dada_files/logs/dada_usage.txt',
                   '/home/account/dada_files/logs/errors.txt'
                 ], 
 
 }); 
 
 for my $file_name(keys %$results){ 
     if($results->{$file_name}->[0]){ 
         print '<h1>' . $file_name . '</h1>'; 
         for my $l(@{$results->{$file_name}}){ 
             print '<p>' . $searcher->html_highlight_line({-query =>  $query, -line => $l }) . '</p>';               
          }
      }
  }
         
 

DIAGNOSTICS

BUGS AND LIMITATIONS

Please report problems to the author of this module

AUTHOR

Justin Simoni

See: http://dadamailproject.com/contact

LICENCE AND COPYRIGHT

Copyright (c) 2006 - 2011 Justin Justin Simoni All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


Dada Mail Project

Download

Installation

Support