GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
PerlIO::eol(3) User Contributed Perl Documentation PerlIO::eol(3)

PerlIO::eol - PerlIO layer for normalizing line endings

This document describes version 0.15 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 "CR", "LF", "CRLF" and "Native" into 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-CRLF" encoding means that all input should be normalized to "LF", and all output should be normalized to "CRLF".

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 ":crlf" or encoding layers before this layer; this is usually done using a ":raw" prefix.

This module also optionally exports a "eol_is_mixed" function; it takes a string and returns the position of the first inconsistent line ending found in that string, or 0 if the line endings are consistent.

The "CR", "LF", "CRLF" and "NATIVE" constants are also exported at request.

A carriage return constant.

A carriage return/line feed constant.

A line feed constant.

The native line ending.

This module also optionally exports a "eol_is_mixed" function; it takes a string and returns the position of the first inconsistent line ending found in that string, or 0 if the line endings are consistent.

Audrey Tang <autrijus@autrijus.org>.

Janitorial help by Gaal Yahas <gaal@forum2.org>.

Inspired by PerlIO::nline by Ben Morrow, <PerlIO-eol@morrow.me.uk>.

Copyright 2004-2006 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.

See <http://www.perl.com/perl/misc/Artistic.html>

2017-12-26 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.