This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Refactoring to Sv*_set() macros - patch #5
[perl5.git] / ext / PerlIO / encoding / encoding.pm
CommitLineData
59035dcc 1package PerlIO::encoding;
c657f685 2use strict;
b162af07 3our $VERSION = '0.08';
c657f685
JH
4our $DEBUG = 0;
5$DEBUG and warn __PACKAGE__, " called by ", join(", ", caller), "\n";
6
7#
1982da40 8# Equivalent of this is done in encoding.xs - do not uncomment.
c657f685 9#
54871a3c 10# use Encode ();
c657f685 11
59035dcc 12use XSLoader ();
c657f685
JH
13XSLoader::load(__PACKAGE__, $VERSION);
14
dc54c799 15our $fallback = Encode::PERLQQ()|Encode::WARN_ON_ERR();
1982da40 16
59035dcc
JH
171;
18__END__
19
20=head1 NAME
21
22PerlIO::encoding - encoding layer
23
24=head1 SYNOPSIS
25
b89cebd3
JH
26 open($f, "<:encoding(foo)", "infoo");
27 open($f, ">:encoding(bar)", "outbar");
59035dcc 28
c657f685 29 use Encode qw(:fallbacks);
e7e5539a 30 $PerlIO::encoding::fallback = FB_PERLQQ;
c00aecee 31
59035dcc
JH
32=head1 DESCRIPTION
33
b89cebd3
JH
34Open a filehandle with a transparent encoding filter.
35
36On input, convert the bytes expected to be in the specified
37character set and encoding to Perl string data (Unicode and
38Perl's internal Unicode encoding, UTF-8). On output, convert
39Perl string data into the specified character set and encoding.
40
e7e5539a 41When the layer is pushed the current value of C<$PerlIO::encoding::fallback>
c00aecee
NIS
42is saved and used as the check argument when calling the Encodings
43encode and decode.
44
b89cebd3
JH
45=head1 SEE ALSO
46
47L<open>, L<Encode>, L<perlfunc/binmode>, L<perluniintro>
2dc05cb3 48
59035dcc
JH
49=cut
50