seperately.
=item * -files
Its value should be an array ref
This is the list of files you'd like to search in. Use absolute paths to these files, ala:
my $results = $searcher->search({
-query => $query,
-files => [
'/home/account/dada_files/logs/dada_usage.txt',
'/home/account/dada_files/logs/errors.txt'
],
});
=back
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.
=head2 html_highlight_line
Takes two arguments - both are required -
They are:
=over
=item * -query
Its value should be a string.
This is the search term you're looking for.
=item * -line
Its value is a string - basically, one of the results that the LogSearch object brings back.
=back
=head1 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'
],
});
foreach my $file_name(keys %$results){
if($results->{$file_name}->[0]){
print '' . $file_name . '
';
foreach my $l(@{$results->{$file_name}}){
print '' . $searcher->html_highlight_line({-query => $query, -line => $l }) . '
';
}
}
}
=head1 DIAGNOSTICS
=head1 BUGS AND LIMITATIONS
Please report problems to the author of this module
=head1 AUTHOR
Justin Simoni
See: http://mojo.skazat.com/contact
=head1 LICENCE AND COPYRIGHT
Copyright (c) 2006 - 2007 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.
=cut