blib/lib/PerlIO/via/Unidecode.pm

filter: Statementstmt 77.2% 17 / 22 Branchbran 50.0% 4 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 2 totaltotal 68.4% 26 / 38 CC 3 SCAR 9.2
CC
3
Cov
70%
WRITE
6.0
FILL
2.0
BEGIN
1.0
CRAP 2.5
↑ Summary
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
BranchTrueFalseTotal
unless defined &PerlIO::via::Unidecode::unidecode 0 2 2
11 2 ▶die "Can't find &utf8::decode" unless defined &utf8::decode;
Branch: 1 branch
BranchTrueFalseTotal
unless defined &utf8::decode 0 2 2
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
BranchTrueFalseTotal
defined $line ? : 2 2 4
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
BranchTrueFalseTotal
print({$_[2];} $x) ? : 0 0 0
28 }
29  
30 2 1;
31 __END__
↑ Summary