Name : perl-Acme-InputRecordSeparatorIsRegexp
| |
Version : 0.07
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : lp154.1.1
| Date : 2023-01-27 16:40:40
|
Group : Development/Libraries/Perl
| Source RPM : perl-Acme-InputRecordSeparatorIsRegexp-0.07-lp154.1.1.src.rpm
|
Size : 0.03 MB
| |
Packager : https://www_suse_com/
| |
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/15.4/noarch |