File-FilterFuncs
view release on metacpan or search on metacpan
to keep lines.
0.51 Sun Jan 28 18:59:28 CST 2007
- Corrected POD error regarding '$/' => \3 (backslash added).
- Added test for using fixed line lengths.
- Added ignore_line() to allow functions to filter lines.
- We die if the source and destination files are the same;
thanks to Uri Guttman <uri[[at]]stemsystems.com> for pointing out
the potential problem.
- Thanks to suggestions from Uri Guttman <uri[[at]]stemsystems.com>,
paragraph reading ($/ = '') and slurp mode ($/ = undef) are
now supported.
0.50 Thu Jan 18 20:43:29 CST 2007
- Included the main code and tests.
0.01 Thu Jan 4 20:08:59 2007
- original version; created by h2xs 1.23 with options
-AX -n File::FilterFuncs
t/File-FilterFuncs.t view on Meta::CPAN
filters (testfile(7), '$/' => \3,
sub { $_ = "$_\n"; 1 }, testfile('7c'));
ok(diff(testfile('7b'), testfile('7c')),
'setting $/ to an integer reference');
# Test reading paragraphs.
open ($infh, '<', $source);
open ($outfh, '>', testfile(8));
{
local $/ = '';
print $outfh "GROUP:$_" while (<$infh>);
}
close $outfh;
close $infh;
filters ($source, '$/' => '',
sub { $_ = "GROUP:$_"; 1 }, testfile('8b'));
ok(diff(testfile(8),testfile('8b')), 'paragraph reading mode ($/ = "")');
# Test the "filter_funcs" function:
filter_funcs($source, testfile(9));
ok(diff($source,testfile(9)), 'use "filter_funcs" (alternate name)');
# Filter out lines with only whitespace.
open ($infh, '<', $source);
open ($outfh, '>', testfile(10));
print $outfh grep /\S/, <$infh>;
close $outfh;
( run in 1.595 second using v1.01-cache-2.11-cpan-364913b4093 )