| 1 | |||||||||||
| 2 | 2 | require 5.008; | |||||||||
| 3 | package PerlIO::via::Unidecode; | ||||||||||
| 4 | # Last-Modified Time-stamp: "2014-07-27 02:49:16 MDT sburke@cpan.org" | ||||||||||
| 5 | 2 | $VERSION = "1.02"; | |||||||||
| 6 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 2 | ▶ | use utf8 ('decode'); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 2 | ▶ | use Text::Unidecode ('unidecode'); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | # A little sanity-checking can't hurt: | ||||||||||
| 10 | 2 | ▶ | die "Can't find &Text::Unidecode::unidecode" unless defined &unidecode; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 11 | 2 | ▶ | die "Can't find &utf8::decode" unless defined &utf8::decode; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 12 | |||||||||||
| 13 | # Coded based on the example of PerlIO::via::QuotedPrint. | ||||||||||
| 14 | |||||||||||
| 15 | 1 | ▶ | sub PUSHED { bless \*PUSHED,$_[0] } | ||||||||
|
Subroutine
PUSHED: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 16 | |||||||||||
| 17 | 4 | ▶ | sub FILL { | ||||||||
|
Subroutine
FILL: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 18 | 4 | my $line = readline( $_[1] ); | |||||||||
| 19 | 4 | ▶ | (defined $line) ? unidecode( $line ) : undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | } | ||||||||||
| 21 | |||||||||||
| 22 | 0 | ▶ | sub WRITE { | ||||||||
|
Subroutine
WRITE: not called CC=2 SCAR=17.9
| |||||||||||
| 23 | 0 | my $x = $_[1]; | |||||||||
| 24 | 0 | utf8::decode($x); # need to promote things back to UTF8 | |||||||||
| 25 | 0 | unidecode($x); | |||||||||
| 26 | # utf8::downgrade($x); | ||||||||||
| 27 | 0 | ▶ | ( print {$_[2]} $x ) ? length($_[1]) : -1; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 2 | 1; | |||||||||
| 31 | __END__ | ||||||||||