Text::Filter::Cooked - Cooked reader for input files
use Text::Filter::Cooked; my $f = Text::Filter::Cooked->new (input => 'myfile.dat', comment => "#", join_lines => "\\"); while ( my $line = $f->readline ) { printf("%3d\t%s\n", $f->lineno, $line); }
Text::Filter::Cooked is a generic input reader. It takes care of a number of things that are commonly used when reading data and configuration files.
Excess whitespace (leading and trailing) may be removed automatically. Also, multiple whitespace characters may be replaced by a single blank.
Empty lines may be ignored automatically.
Lines that end with a custom defined join symbol, ususally a backslash, are joined with the next line.
Lines that start with a custom defined comment symbol are ignored.
Text::Filter::Cooked is based on Text::Filter, see Text::Filter.
The constructor is called new() and takes a hash with attributes as its parameter.
The following attributes are recognized and used by the constructor, all others are passed to the base class, Text::Filter.
If true, empty lines encountered in the input are ignored.
If true, leading whitespace encountered in the input is ignored.
If true, trailing whitespace encountered in the input is ignored.
If true, multiple adjacent whitespace are compressed to a single space.
This must be set to a string. Input lines that end with this string (not taking the final line ending into account) are joined with the next line read from the input.
This must be set to a string. Input lines that start with this string are ignored.
2 POD Errors
The following errors were encountered while parsing the POD:
=over without closing =back
Non-ASCII character seen before =encoding in 'Thïs'. Assuming CP1252
To install Text::Filter, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::Filter
CPAN shell
perl -MCPAN -e shell install Text::Filter
For more information on module installation, please visit the detailed CPAN module installation guide.