Name : perl-Acme-InputRecordSeparatorIsRegexp
| |
Version : 0.07
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : 1.27
| Date : 2022-05-30 17:44:09
|
Group : Development/Libraries/Perl
| Source RPM : perl-Acme-InputRecordSeparatorIsRegexp-0.07-1.27.src.rpm
|
Size : 0.03 MB
| |
Packager : (none)
| |
Summary : Awk Doesn\'t Have to Be Better at Something
|
Description :
In the section about the \"input record separator\", \'perlvar\' famously quips
Remember: the value of $/ is a string, not a regex. *awk* has to be better for something. :-)
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 (\'\ \'), Windows/DOS (\'\\r\ \'), or Mac (\'\\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\ |\\r|\ \'; open $fh, \'< \', \'file-with-ambiguous-line-endings\';
AATTlines = < $fh> while (my $line = < $fh>) { ... }
The lines produced by the \'< $fh>\' expression, like the builtin \'readline\' function and operator, include the record separator at the end of the line, so the lines returned may end in \'\\r\ \', \'\\r\', or \'\ \'.
Another use case is files that contain multiple types of records where a different sequence of characters is used to denote the end of different types of records.
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-A/openSUSE_Tumbleweed/noarch |