> Does it (a :crlf layer) still interfere with tell() even when it's disabled ?

No. But if you later add (binmode) a :crlf layer then it can enable it at the wrong 'level'. This is a common mistake when using utf(16|32) eg.

# wrong way to write utf16 open $fout, ">", $file or die; binmode $fout, ":encoding(utf16le)" or die; print $fout "abc\n123\n\n"; close $fout;
this results in CRLF being output as "0D 0A 00" bytes. Oops. What you need is:
# OK open $fout, ">:raw:encoding(utf16le):crlf", $file or die; # etc.

Bascially there are known bugs with mixing :encoding and :crlf layers and suggest that if you need both that you test well to ensure you're not hitting them. (Also check the Perl bug database).

Your code gave for me on windows:

3: unix 4195328 crlf 4195328 4: unix 4195328 crlf 4195328 perlio 4195328

> If one has to use open($fh, '<:raw:perlio', $file) to get a clean and buffered binary stream this unconditionally forces a :perlio layer onto the stack, which in turn inserts a :unix layer below it.

NB. my original point was about creating a raw byte stream that you *then* wanted to add :encoding layers to.

NB. the reason for the :perlio in  open $fin, "<:raw:perlio" is to give the filehandle the ability to be -B/-T -able. Consider:

C:\>perl -we "open $fin, '<:raw', $^X or die; die if -B $fin -T and -B not implemented on filehandles at -e line 1. C:\>perl -we "open $fin, '<:raw:perlio', $^X or die; die if -B $fin Died at -e line 1.

If all you want *is* a binary, then either of:

open $fin1, "<", $foo or die; binmode $fin1; open $fin2, "<:raw", $bar or die;
are equivalent (and you can forget all my ramblings :-)

In reply to Re^4: Using ":raw" layer in open() vs. calling binmode() by Anonymous Monk
in thread Using ":raw" layer in open() vs. calling binmode() by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.