Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | package PerlIO::encoding; |
2 | use strict; | |
3 | our $VERSION = '0.06'; | |
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 = Encode::PERLQQ()|Encode::WARN_ON_ERR(); | |
16 | ||
17 | 1; | |
18 | __END__ | |
19 | ||
20 | =head1 NAME | |
21 | ||
22 | PerlIO::encoding - encoding layer | |
23 | ||
24 | =head1 SYNOPSIS | |
25 | ||
26 | open($f, "<:encoding(foo)", "infoo"); | |
27 | open($f, ">:encoding(bar)", "outbar"); | |
28 | ||
29 | use Encode qw(:fallbacks); | |
30 | $PerlIO::encoding::check = FB_PERLQQ; | |
31 | ||
32 | =head1 DESCRIPTION | |
33 | ||
34 | Open a filehandle with a transparent encoding filter. | |
35 | ||
36 | On input, convert the bytes expected to be in the specified | |
37 | character set and encoding to Perl string data (Unicode and | |
38 | Perl's internal Unicode encoding, UTF-8). On output, convert | |
39 | Perl string data into the specified character set and encoding. | |
40 | ||
41 | When the layer is pushed the current value of C<$PerlIO::encoding::check> | |
42 | is saved and used as the check argument when calling the Encodings | |
43 | encode and decode. | |
44 | ||
45 | =head1 SEE ALSO | |
46 | ||
47 | L<open>, L<Encode>, L<perlfunc/binmode>, L<perluniintro> | |
48 | ||
49 | =cut | |
50 |