16 Dec 2006 03:19:52 UTC
- Distribution: PerlIO-eol
- Module version: 0.14
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (3)
- Testers (2898 / 8 / 33)
- KwaliteeBus factor: 2
- 100.00% Coverage
- License: perl_5
- Perl: v5.7.3
- Activity24 month
- Download (17.31KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionAUDREYT ☻ 唐鳳 ☺and 1 contributors
- Audrey Tang
PerlIO::eol - PerlIO layer for normalizing line endings
This document describes version 0.14 of PerlIO::eol, released December 18, 2006.
binmode STDIN, ":raw:eol(LF)"; binmode STDOUT, ":raw:eol(CRLF)"; open FH, "+<:raw:eol(LF-Native)", "file"; binmode STDOUT, ":raw:eol(CRLF?)"; # warns on mixed newlines binmode STDOUT, ":raw:eol(CRLF!)"; # dies on mixed newlines use PerlIO::eol qw( eol_is_mixed ); my $pos = eol_is_mixed( "mixed\nstring\r" );
This layer normalizes any of
Nativeinto the designated line ending. It works for both input and output handles.
If you specify two different line endings joined by a
-, it will use the first one for reading and the second one for writing. For example, the
LF-CRLFencoding means that all input should be normalized to
LF, and all output should be normalized to
By default, data with mixed newlines are normalized silently. Append a
!to the line ending will raise a fatal exception when mixed newlines are spotted. Append a
?will raise a warning instead.
It is advised to pop any potential
:crlfor encoding layers before this layer; this is usually done using a
This module also optionally exports a
eol_is_mixedfunction; it takes a string and returns the position of the first inconsistent line ending found in that string, or
0if the line endings are consistent.
NATIVEconstants are also exported at request.
Audrey Tang <email@example.com>.
Janitorial help by Gaal Yahas <firstname.lastname@example.org>.
Inspired by PerlIO::nline by Ben Morrow, <PerlIOemail@example.com>.
Copyright 2004-2006 by Audrey Tang <firstname.lastname@example.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.