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