package open;
use warnings;
-use Carp;
$open::hint_bits = 0x20000; # HINT_LOCALIZE_HH
-our $VERSION = '1.04';
+our $VERSION = '1.05';
require 5.008001; # for PerlIO::get_layers()
return;
}
+sub croak {
+ require Carp; goto &Carp::croak;
+}
+
sub _drop_oldenc {
# If by the time we arrive here there already is at the top of the
# perlio layer stack an encoding identical to what we would like
require Encode;
my ($loname, $lcname) = _get_encname($old[-2]);
unless (defined $lcname) { # Should we trust get_layers()?
- require Carp;
- Carp::croak("open: Unknown encoding '$loname'");
+ croak("open: Unknown encoding '$loname'");
}
my ($voname, $vcname) = _get_encname($new[-1]);
unless (defined $vcname) {
- require Carp;
- Carp::croak("open: Unknown encoding '$voname'");
+ croak("open: Unknown encoding '$voname'");
}
if ($lcname eq $vcname) {
binmode($h, ":pop"); # utf8 is part of the encoding layer
Note that C<:utf8> PerlIO layer must always be specified exactly like
that, it is not subject to the loose matching of encoding names.
-When open() is given an explicit list of layers they are appended to
-the list declared using this pragma.
+When open() is given an explicit list of layers (with the three-arg
+syntax), they override the list declared using this pragma.
The C<:std> subpragma on its own has no effect, but if combined with
the C<:utf8> or C<:encoding> subpragmas, it converts the standard
STDOUT and STDERR to be in C<koi8r>. The C<:locale> subpragma
implicitly turns on C<:std>.
-The logic of C<:locale> is described in full in L</encoding>,
+The logic of C<:locale> is described in full in L<encoding>,
but in short it is first trying nl_langinfo(CODESET) and then
guessing from the LC_ALL and LANG locale environment variables.