Acme-InputRecordSeparatorIsRegexp
view release on metacpan or search on metacpan
89101112131415161718192021222324252627
Remember: the value of $/ is a string, not a regex. awk
has
to
be better
for
something. :-)
This module attempts to get
around
that limitation, providing
a mechanism (using
tied
filehandles) to get the
readline
function
(and
readline
operator <...>) to define
"lines"
with
respect to
a regular expression.
whether is uses Unix (\n), Windows/DOS (\r\n), or Mac (\r)
style line-endings, or even
if
it might contain all three.
where a different sequence of characters is used to denote the
end of different types of records.
INSTALLATION
To install this module, run the following commands:
lib/Acme/InputRecordSeparatorIsRegexp.pm view on Meta::CPAN
491492493494495496497498499500501502503504505506507508509510511Remember: the value of $/ is a string, not a regex. B<awk>
has
to be better
for
something. :-)
=back
This module provides a mechanism to read records from a file
using a regular expression as a record separator.
A common use case for this module is to read a text file
that you don't know whether it uses Unix (C<\n>),
Windows/DOS (C<\r\n>), or Mac (C<\r>) style line-endings,
or even if it might contain all three. To properly parse
this file, you could tie its file handle to this package with
the appropriate regular expression:
my $fh = Symbol::gensym;
tie *$fh, 'Acme::InputRecordSeparatorIsRegexp', '\r\n|\r|\n';
open $fh, '<', 'file-with-ambiguous-line-endings';
@lines = <$fh>;
# or
t/pod-coverage.t view on Meta::CPAN
4567891011121314151617181920use
Test::More;
# Ensure a recent version of Test::Pod::Coverage
my
$min_tpc
= 1.08;
eval
"use Test::Pod::Coverage $min_tpc"
;
plan
skip_all
=>
"Test::Pod::Coverage $min_tpc required for testing POD coverage"
if
$@;
# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version,
# but older versions don't recognize some common documentation styles
my
$min_pc
= 0.18;
eval
"use Pod::Coverage $min_pc"
;
plan
skip_all
=>
"Pod::Coverage $min_pc required for testing POD coverage"
if
$@;
all_pod_coverage_ok();
( run in 0.247 second using v1.01-cache-2.11-cpan-cba739cd03b )