1Encode::Newlines(3)   User Contributed Perl Documentation  Encode::Newlines(3)
2
3
4

NAME

6       Encode::Newlines - Normalize line ending sequences
7

VERSION

9       This document describes version 0.04 of Encode::Newlines, released
10       September 4, 2007.
11

SYNOPSIS

13           use Encode;
14           use Encode::Newlines;
15
16           # Convert to native newlines
17           # Note that decode() and encode() are equivalent here
18           $native = decode(Native => $string);
19           $native = encode(Native => $string);
20
21           {
22               # Allow mixed newlines in $mixed
23               local $Encode::Newlines::AllowMixed = 1;
24               $cr = encode(CR => $mixed);
25           }
26

DESCRIPTION

28       This module provides the "CR", "LF", "CRLF" and "Native" encodings, to
29       aid in normalizing line endings.
30
31       It converts whatever line endings the source uses to the designated
32       newline sequence, for both "encode" and "decode" operations.
33
34       If you specify two different line endings joined by a "-", it will use
35       the first one for decoding and the second one for encoding.  For
36       example, the "LF-CRLF" encoding means that all input should be
37       normalized to "LF", and all output should be normalized to "CRLF".
38
39       If the source has an inconsistent line ending style, then a "Mixed
40       newlines" exception is raised on behalf of the caller.  However, if the
41       package variable $Encode::Newlines::AllowMixed is set to a true value,
42       then it will silently convert all three line endings.
43

CAVEATS

45       This module is not suited for working with PerlIO::encoding, because it
46       cannot guarantee that the chunk bounaries won't happen within a CR/LF
47       sequence.  See PerlIO::eol for how to deal with this correctly.
48
49       An optional XS implemenation would be nice.
50

AUTHORS

52       Audrey Tang <audreyt@audreyt.org>
53
55       Copyright 2004-2007 by Audrey Tang <audreyt@audreyt.org>.
56
57       This program is free software; you can redistribute it and/or modify it
58       under the same terms as Perl itself.
59
60       See <http://www.perl.com/perl/misc/Artistic.html>
61
62
63
64perl v5.36.0                      2023-01-20               Encode::Newlines(3)
Impressum