Upgrade to Encode 2.11, plus a patch to PerlIO::encoding
[p5sagit/p5-mst-13.2.git] / ext / PerlIO / encoding / encoding.pm
1 package PerlIO::encoding;
2 use strict;
3 our $VERSION = '0.09';
4 our $DEBUG = 0;
5 $DEBUG and warn __PACKAGE__, " called by ", join(", ", caller), "\n";
6
7 #
8 # Equivalent of this is done in encoding.xs - do not uncomment.
9 #
10 # use Encode ();
11
12 use XSLoader ();
13 XSLoader::load(__PACKAGE__, $VERSION);
14
15 our $fallback =
16     Encode::PERLQQ()|Encode::WARN_ON_ERR()|Encode::STOP_AT_PARTIAL();
17
18 1;
19 __END__
20
21 =head1 NAME
22
23 PerlIO::encoding - encoding layer
24
25 =head1 SYNOPSIS
26
27   open($f, "<:encoding(foo)", "infoo");
28   open($f, ">:encoding(bar)", "outbar");
29
30   use Encode qw(:fallbacks);
31   $PerlIO::encoding::fallback = FB_PERLQQ;
32
33 =head1 DESCRIPTION
34
35 Open a filehandle with a transparent encoding filter.
36
37 On input, convert the bytes expected to be in the specified
38 character set and encoding to Perl string data (Unicode and
39 Perl's internal Unicode encoding, UTF-8).  On output, convert
40 Perl string data into the specified character set and encoding.
41
42 When the layer is pushed the current value of C<$PerlIO::encoding::fallback>
43 is saved and used as the check argument when calling the Encodings
44 encode and decode.
45
46 =head1 SEE ALSO
47
48 L<open>, L<Encode>, L<perlfunc/binmode>, L<perluniintro>
49
50 =cut
51