vr has asked for the wisdom of the Perl Monks concerning the following question:
Are leading colons, really, proper part of IO layers names?
Are they just separators between layers and/or file opening mode, when these things are written as single string, chained together? And then, they (colons) are somehow stuck in front of every name, when such a name is mentioned in documentation? Moreover, it even appears that it was done on purpose to help reading, so that names stand out in text, as in "Look, I'm an IO layer name!"
PerlIO, binmode, etc. have leading colon as part of each name. However, PerlIO in its second part stops prepending colons.
Looks like everything (with exception, see further) works OK without colons:
D:\>perl -wE "binmode STDOUT, 'utf8'; use open IO => 'raw'" D:\>perl -wE "say for PerlIO::get_layers(STDOUT)" unix crlf D:\>perl -wE "use open ':utf8';" # OK D:\>perl -wE "use open 'utf8';" # OK D:\>perl -wE "use open 'encoding(ASCII)';" # OK D:\>perl -wE "use open ':encoding(ASCII)';" # OK D:\>perl -wE "use open ':std';" # OK D:\>perl -MPerlIO -wE "use open 'std';" Unknown PerlIO layer class 'std' (need IN, OUT or IO) at -e line 1. BEGIN failed--compilation aborted at -e line 1.
Because it's not really a layer name, but 'subpragma' (??), to be used as:
D:\>perl -wE "use open ':std' => 'utf8';"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Colons in names of IO layers
by tobyink (Canon) on Mar 01, 2019 at 23:11 UTC |