-
-
11 Jan 2016 23:00:31 UTC
- Distribution: Encode-Newlines
- Module version: 0.05
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues
- Testers (4081 / 0 / 0)
- Kwalitee
Bus factor: 2- 90.41% Coverage
- License: perl_5
- Perl: v5.7.3
- Activity
24 month- Tools
- Download (10.32KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
NAME
Encode::Newlines - Normalize line ending sequences
VERSION
This document describes version 0.04 of Encode::Newlines, released September 4, 2007.
SYNOPSIS
use Encode; use Encode::Newlines; # Convert to native newlines # Note that decode() and encode() are equivalent here $native = decode(Native => $string); $native = encode(Native => $string); { # Allow mixed newlines in $mixed local $Encode::Newlines::AllowMixed = 1; $cr = encode(CR => $mixed); }
DESCRIPTION
This module provides the
CR
,LF
,CRLF
andNative
encodings, to aid in normalizing line endings.It converts whatever line endings the source uses to the designated newline sequence, for both
encode
anddecode
operations.If you specify two different line endings joined by a
-
, it will use the first one for decoding and the second one for encoding. For example, theLF-CRLF
encoding means that all input should be normalized toLF
, and all output should be normalized toCRLF
.If the source has an inconsistent line ending style, then a
Mixed newlines
exception is raised on behalf of the caller. However, if the package variable$Encode::Newlines::AllowMixed
is set to a true value, then it will silently convert all three line endings.CAVEATS
This module is not suited for working with PerlIO::encoding, because it cannot guarantee that the chunk bounaries won't happen within a CR/LF sequence. See PerlIO::eol for how to deal with this correctly.
An optional XS implemenation would be nice.
AUTHORS
Audrey Tang <audreyt@audreyt.org>
COPYRIGHT AND LICENSE
Copyright 2004-2007 by Audrey Tang <audreyt@audreyt.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Module Install Instructions
To install Encode::Newlines, copy and paste the appropriate command in to your terminal.
cpanm Encode::Newlines
perl -MCPAN -e shell install Encode::Newlines
For more information on module installation, please visit the detailed CPAN module installation guide.