List::RewriteElements 0.09
Sponsored Links
List::RewriteElements 0.09 Ranking & Summary
File size:
0.026 MB
Platform:
Any Platform
License:
Perl Artistic License
Price:
Downloads:
840
Date added:
2007-07-10
Publisher:
James E Keenan
List::RewriteElements 0.09 description
List::RewriteElements is a Perl module that can create a new list by rewriting elements of a first list.
SYNOPSIS
use List::RewriteElements;
Constructor
Simplest case: Input from array, output to STDOUT.
$lre = List::RewriteElements->new( {
list => @source,
body_rule => sub {
my $record = shift;
$record .= q{additional field};
},
} );
Input from file, output to STDOUT:
$lre = List::RewriteElements->new( {
file => "/path/to/source/file",
body_rule => sub {
my $record = shift;
$record .= q{,additional field};
},
} );
Provide a different rule for the first element in the list:
$lre = List::RewriteElements->new( {
file => "/path/to/source/file",
header_rule => sub {
my $record = shift;
$record .= q{,ADDITIONAL HEADER};
},
body_rule => sub {
my $record = shift;
$record .= q{,additional field};
},
} );
Input from file, output to file:
$lre = List::RewriteElements->new( {
file => "/path/to/source/file",
body_rule => sub {
my $record = shift;
$record .= q{additional field};
},
output_file => "/path/to/output/file",
} );
To name output file, just provide a suffix to filename:
$lre = List::RewriteElements->new( {
file => "/path/to/source/file",
body_rule => sub {
my $record = shift;
$record .= q{additional field};
},
output_suffix => .out,
} );
Provide criteria to suppress output of header or individual record.
$lre = List::RewriteElements->new( {
file => "/path/to/source/file",
header_suppress => sub {
my $record = shift;
return if $record =~ /$somepattern/;
},
body_suppress => sub {
my $record = shift;
return if $record ne somestring;
},
body_rule => sub {
my $record = shift;
$record .= q{additional field};
},
} );
Generate Output
$lre->generate_output();
Report Output Information
$path_to_output_file = $lre->get_output_path();
$output_file_basename = $lre->get_output_basename();
$output_row_count = $lre->get_total_rows();
$output_record_count = $lre->get_total_records();
$records_changed = $lre->get_records_changed();
$records_unchanged = $lre->get_records_unchanged();
$records_deleted = $lre->get_records_deleted();
$header_status = $lre->get_header_status();
It is common in many situations for you to receive a flat data file from someone else and have to generate a new file in which each row or record in the incoming file must either (a) be transformed according to some rule before being printing to the new file; or (b) if it meets certain criteria, not output to the new file at all.
List::RewriteElements enables you to write such rules and criteria, generate the file of transformed data records, and get back some basic statistics about the transformation.
List::RewriteElements is useful when the number of records in the incoming file may be large and you do not want to hold the entire list in memory. Similarly, the newly generated records are not held in memory but are immediately printed to STDOUT or to file.
On the other hand, if for some reason you already have an array of records in memory, you can use List::RewriteElements to apply rules and criteria to each element of the array and then print the transformed records (again, without holding the output in memory).
SYNOPSIS
use List::RewriteElements;
Constructor
Simplest case: Input from array, output to STDOUT.
$lre = List::RewriteElements->new( {
list => @source,
body_rule => sub {
my $record = shift;
$record .= q{additional field};
},
} );
Input from file, output to STDOUT:
$lre = List::RewriteElements->new( {
file => "/path/to/source/file",
body_rule => sub {
my $record = shift;
$record .= q{,additional field};
},
} );
Provide a different rule for the first element in the list:
$lre = List::RewriteElements->new( {
file => "/path/to/source/file",
header_rule => sub {
my $record = shift;
$record .= q{,ADDITIONAL HEADER};
},
body_rule => sub {
my $record = shift;
$record .= q{,additional field};
},
} );
Input from file, output to file:
$lre = List::RewriteElements->new( {
file => "/path/to/source/file",
body_rule => sub {
my $record = shift;
$record .= q{additional field};
},
output_file => "/path/to/output/file",
} );
To name output file, just provide a suffix to filename:
$lre = List::RewriteElements->new( {
file => "/path/to/source/file",
body_rule => sub {
my $record = shift;
$record .= q{additional field};
},
output_suffix => .out,
} );
Provide criteria to suppress output of header or individual record.
$lre = List::RewriteElements->new( {
file => "/path/to/source/file",
header_suppress => sub {
my $record = shift;
return if $record =~ /$somepattern/;
},
body_suppress => sub {
my $record = shift;
return if $record ne somestring;
},
body_rule => sub {
my $record = shift;
$record .= q{additional field};
},
} );
Generate Output
$lre->generate_output();
Report Output Information
$path_to_output_file = $lre->get_output_path();
$output_file_basename = $lre->get_output_basename();
$output_row_count = $lre->get_total_rows();
$output_record_count = $lre->get_total_records();
$records_changed = $lre->get_records_changed();
$records_unchanged = $lre->get_records_unchanged();
$records_deleted = $lre->get_records_deleted();
$header_status = $lre->get_header_status();
It is common in many situations for you to receive a flat data file from someone else and have to generate a new file in which each row or record in the incoming file must either (a) be transformed according to some rule before being printing to the new file; or (b) if it meets certain criteria, not output to the new file at all.
List::RewriteElements enables you to write such rules and criteria, generate the file of transformed data records, and get back some basic statistics about the transformation.
List::RewriteElements is useful when the number of records in the incoming file may be large and you do not want to hold the entire list in memory. Similarly, the newly generated records are not held in memory but are immediately printed to STDOUT or to file.
On the other hand, if for some reason you already have an array of records in memory, you can use List::RewriteElements to apply rules and criteria to each element of the array and then print the transformed records (again, without holding the output in memory).
List::RewriteElements 0.09 Screenshot
List::RewriteElements 0.09 Keywords
RewriteElements
RewriteElements 0.09
STDOUT
Perl module
NEW LIST
List By
In Memory
Can Create
record
file
output
new
records
list
List::RewriteElements
ListRewriteElements
Bookmark List::RewriteElements 0.09
List::RewriteElements 0.09 Copyright
WareSeeker periodically updates pricing and software information of List::RewriteElements 0.09 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of List::RewriteElements 0.09 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
Related Software
CGI::Utils is a Perl module for retrieving information through the Common Gateway Interface and mod_perl. Free Download
List::Comprehensions is a Perl module that allows for list comprehensions in Perl. Free Download
List::Maker is a Perl module that can generate more sophisticated lists than just $a..$b. Free Download
List::Intersperse Perl module can intersperse / unsort / disperse a list. Free Download
FreeTranslate allows you to translate individual words on a web page. Free Download
List::MRU is a Perl module that implements a simple fixed-size MRU-ordered list. Free Download
Gtk2::Ex::Utils is a Perl module with extra Gtk2 Utilities for working with Gnome2/Gtk2 in Perl. Free Download
List::Util::Superpositions is a Perl module that provides any and all for lists. Free Download
Latest Software
Popular Software
Favourite Software