Integrate mainline into perlio
[p5sagit/p5-mst-13.2.git] / ext / PerlIO / encoding / encoding.pm
1 package PerlIO::encoding;
2 our $VERSION = '0.03';
3 use XSLoader ();
4 use Encode (); # Load but do not import anything.
5 our $check;
6 XSLoader::load 'PerlIO::encoding';
7 1;
8 __END__
9
10 =head1 NAME
11
12 PerlIO::encoding - encoding layer
13
14 =head1 SYNOPSIS
15
16   open($f, "<:encoding(foo)", "infoo");
17   open($f, ">:encoding(bar)", "outbar");
18
19   use Encode;
20   $PerlIO::encoding::check = Encode::FB_PERLQQ();
21
22 =head1 DESCRIPTION
23
24 Open a filehandle with a transparent encoding filter.
25
26 On input, convert the bytes expected to be in the specified
27 character set and encoding to Perl string data (Unicode and
28 Perl's internal Unicode encoding, UTF-8).  On output, convert
29 Perl string data into the specified character set and encoding.
30
31 When the layer is pushed the current value of C<$PerlIO::encoding::check>
32 is saved and used as the check argument when calling the Encodings
33 encode and decode.
34
35 =head1 SEE ALSO
36
37 L<open>, L<Encode>, L<perlfunc/binmode>, L<perluniintro>
38
39 =cut
40
41