File Coverage

blib/lib/PerlIO/text.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1             package PerlIO::text;
2             {
3             $PerlIO::text::VERSION = '0.007';
4             }
5 1     1   794 use 5.008;
  1         3  
  1         37  
6 1     1   6 use strict;
  1         2  
  1         32  
7 1     1   6 use warnings;
  1         2  
  1         33  
8              
9 1     1   5 use XSLoader;
  1         3  
  1         57  
10              
11             XSLoader::load(__PACKAGE__, __PACKAGE__->VERSION);
12              
13             1;
14              
15              
16              
17             =pod
18              
19             =head1 NAME
20              
21             PerlIO::text
22              
23             =head1 VERSION
24              
25             version 0.007
26              
27             =head1 SYNOPSIS
28              
29             open my $fh, '<:text(UTF-16LE)', $filename;
30              
31             =head1 DESCRIPTION
32              
33             This module provides a textual pseudo-layer. Instead of pushing itself, it pushes the right layers to open text files in the specified encoding.
34              
35             =encoding utf8
36              
37             =head1 SYNTAX
38              
39             This modules does not have to be loaded explicitly, it will be loaded automatically by using it in an open mode. The module has the following general syntax: C<:text(charset)>. C is mandatory and without it this module will give an error. Any character-set known to L may be given as an argument.
40              
41             =head1 PHILOSPHY
42              
43             This modules tried to Do The Right Thing™. That means that it won't do the same on all platforms, and that it may do something smarter in the future (such as Unicode normalization).
44              
45             =head1 RATIONALE
46              
47             At first sight this module may seem merely a wrapper around C<:encoding>, and in fact on unix it pretty much is. Its main reason of existence is that many multibyte encodings are not crlf safe, resulting is issues on Windows. A mode of C<< >:encoding(UTF-16LE) >> does the wrong thing by doing crlf translation B the UTF-16 encoding, this causes an output that is not valid UTF-16. Instead this module does something along these lines on Windows: C<< >:raw:encoding(UTF-16-LE):crlf >>, which is correct but horrible from a huffmanization point of view and it adds complexity to your code because now the correct open mode depends on the platform. This module abstracts that complication.
48              
49             =head1 AUTHOR
50              
51             Leon Timmermans
52              
53             =head1 COPYRIGHT AND LICENSE
54              
55             This software is copyright (c) 2011 by Leon Timmermans.
56              
57             This is free software; you can redistribute it and/or modify it under
58             the same terms as the Perl 5 programming language system itself.
59              
60             =cut
61              
62              
63             __END__