PerlIO::eol(3pm)
π PerlIO::eol β the User Contributed Perl Documentation glow-up π¦
okay bestie, so this is PerlIO::eol(3pm), and it's literally the layer that fixes your line endings so you never have to think about CR vs LF again. it's giving β¨normalizationβ¨. pull up a chair, we're doing this together π«Ά
β¨ NAME β¨
PerlIO::eol β the PerlIO layer for normalizing line endings π
π VERSION π
this doc is describing version 0.18 of PerlIO::eol, and girl, it was released December 18, 2006 π iconic vintage behavior, we respect it
β SYNOPSIS β
here's the whole vibe in code, no cap:
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" );
π DESCRIPTION π
so basically this layer takes any of CR, LF, CRLF and Native and normalizes them all into whatever line ending you picked. it works on input handles and output handles, both of them, we're equal opportunity like that π
if you give it two different line endings joined by a -, it uses the first one for reading and the second one for writing. so for example LF-CRLF means all input gets normalized to LF, and all output gets normalized to CRLF. two moods, one layer π
by default, data with mixed newlines gets normalized silently β no drama, no notes. but! if you append a ! to the line ending, it will raise a fatal exception when mixed newlines show up π and if you append a ?, it raises a warning instead. choose your fighter π₯
it is advised to pop any potential:crlfor encoding layers before this layer β and the usual way to do that is with a:rawprefix. keep the order right bestie, it matters fr fr.
this module also optionally exports an eol_is_mixed function: you hand it a string and it returns the position of the first inconsistent line ending it finds in that string, or 0 if the line endings are all consistent β¨
and the CR, LF, CRLF and NATIVE constants are also exported, but only if you ask nicely π
πΈ EXPORTS πΈ
π CR
a carriage return constant.
π CRLF
a carriage return / line feed constant.
π LF
a line feed constant.
π NATIVE
the native line ending.
π eol_is_mixed
this module also optionally exports an 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 π§
π«Ά AUTHORS π«Ά
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 π
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> π
and that's the whole page bestie, you ate it, periodt π this was perl v5.42.3, dated 2026-08-19, and it's PerlIO::eol(3pm) signing off β go normalize something, you main character πβ¨π¦
π¦ where this page comes from
- ubuntu stonking: libperlio-eol-perl 0.19-1build5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms