Commit | Line | Data |
59035dcc |
1 | package PerlIO::encoding; |
c657f685 |
2 | use strict; |
56ff7374 |
3 | our $VERSION = '0.09'; |
c657f685 |
4 | our $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 |
12 | use XSLoader (); |
c657f685 |
13 | XSLoader::load(__PACKAGE__, $VERSION); |
14 | |
56ff7374 |
15 | our $fallback = |
16 | Encode::PERLQQ()|Encode::WARN_ON_ERR()|Encode::STOP_AT_PARTIAL(); |
1982da40 |
17 | |
59035dcc |
18 | 1; |
19 | __END__ |
20 | |
21 | =head1 NAME |
22 | |
23 | PerlIO::encoding - encoding layer |
24 | |
25 | =head1 SYNOPSIS |
26 | |
b89cebd3 |
27 | open($f, "<:encoding(foo)", "infoo"); |
28 | open($f, ">:encoding(bar)", "outbar"); |
59035dcc |
29 | |
c657f685 |
30 | use Encode qw(:fallbacks); |
e7e5539a |
31 | $PerlIO::encoding::fallback = FB_PERLQQ; |
c00aecee |
32 | |
59035dcc |
33 | =head1 DESCRIPTION |
34 | |
b89cebd3 |
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 | |
e7e5539a |
42 | When the layer is pushed the current value of C<$PerlIO::encoding::fallback> |
c00aecee |
43 | is saved and used as the check argument when calling the Encodings |
44 | encode and decode. |
45 | |
b89cebd3 |
46 | =head1 SEE ALSO |
47 | |
48 | L<open>, L<Encode>, L<perlfunc/binmode>, L<perluniintro> |
2dc05cb3 |
49 | |
59035dcc |
50 | =cut |
51 | |