File::Searcher 0.91 review

Download
by rbytes.net on

File::Searcher is a searches for files and performs search/replacements on matching files. SYNOPSIS use File::Searcher;

License: Perl Artistic License
File size: 8K
Developer: Adam Stubbs
0 stars award from rbytes.net

File::Searcher is a searches for files and performs search/replacements on matching files.

SYNOPSIS

use File::Searcher;
my $search = File::Searcher->new('*.cgi');
$search->add_expression(name=>'street',
search=>'1234 Easy St.',
replace=>'456 Hard Way',
options=>'i');
$search->add_expression(name=>'department',
search=>'(Dept.|Department)(s+)(d+)',
replace=>'$1$2$3',
options=>'im');
$search->add_expression(name=>'place',
search=>'Portland, OR(.*?)97212',
replace=>'Vicksburg, MI${1}49097',
options=>'is');
$search->start;
# $search->interactive; SEE File::Searcher::Interactive
@files_matched = $search->files_matched;
print "Files Matchedn";
print "t" . join("nt", @files_matched) . "n";
print "Total Files:t" . $search->file_cnt . "n";
print "Directories:t" . $search->dir_cnt . "n";
my @files_replaced = $search->expression('street')->files_replaced;
my @files_replaced = $search->expression($expression)->files_replaced;
my %matches = $search->expression('street')->matches;
my %replacements = $search->expression('street')->replacements;

File::Searcher allows for the traversing of a directory tree for files matching a Perl regular expression. When a match is found, the statistics are stored and if the file is a text file a series of searches and replacements can be performed. File::Searcher has options that allow for backing-up / archiving files and has OO access to reporting and statistics of matches and replacements.

Requirements:
Perl

File::Searcher 0.91 search tags