File Coverage

blib/lib/Lingua/EN/Pseudolocalize.pm
Criterion Covered Total %
statement 21 21 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 2 2 100.0
total 30 30 100.0


line stmt bran cond sub pod time code
1             package Lingua::EN::Pseudolocalize;
2 1     1   12382 use strict; use warnings; use 5.008;
  1     1   1  
  1     1   35  
  1         4  
  1         1  
  1         26  
  1         15  
  1         5  
  1         35  
3 1     1   516 use Sub::Exporter::Simple qw/convert deconvert/;
  1         12226  
  1         6  
4 1     1   1516 use charnames ':full';
  1         29081  
  1         8  
5              
6             # ABSTRACT: Test Unicode support by pretending to speak a different language.
7              
8             my $lookup = {
9             'th' => "\N{LATIN SMALL LETTER TH WITH STRIKETHROUGH}",
10             'ts' => "\N{LATIN SMALL LETTER TS DIGRAPH}",
11             'st' => "\N{LATIN SMALL LIGATURE ST}",
12             'a' => "\N{LATIN SMALL LETTER A WITH HOOK ABOVE}",
13             'b' => "\N{LATIN SMALL LETTER B WITH MIDDLE TILDE}",
14             'd' => "\N{LATIN SMALL LETTER D WITH CURL}",
15             'e' => "\N{LATIN SMALL LETTER E WITH INVERTED BREVE}",
16             'i' => "\N{LATIN SMALL LETTER I WITH DIAERESIS AND ACUTE}",
17             'o' => "\N{LATIN SMALL LETTER O WITH DOT ABOVE}",
18             'u' => "\N{LATIN SMALL LETTER U WITH HORN AND HOOK ABOVE}",
19             'A' => "\N{LATIN CAPITAL LETTER A WITH RING BELOW}",
20             'E' => "\N{LATIN CAPITAL LETTER E WITH TILDE BELOW}",
21             'I' => "\N{LATIN CAPITAL LETTER I WITH INVERTED BREVE}",
22             'O' => "\N{LATIN CAPITAL LETTER O WITH STROKE AND ACUTE}",
23             'U' => "\N{LATIN CAPITAL LETTER U WITH DIAERESIS BELOW}",
24             'T' => "\N{LATIN CAPITAL LETTER T WITH HOOK}",
25             'N' => "\N{LATIN CAPITAL LETTER N WITH ACUTE}",
26             'S' => "\N{LATIN CAPITAL LETTER S WITH COMMA BELOW}",
27             'H' => "\N{LATIN CAPITAL LETTER H WITH DIAERESIS}",
28             'R' => "\N{LATIN CAPITAL LETTER R WITH DOT BELOW AND MACRON}",
29             'D' => "\N{LATIN CAPITAL LETTER D WITH STROKE}",
30             'L' => "\N{LATIN CAPITAL LETTER L WITH MIDDLE DOT}",
31             };
32              
33             sub convert {
34 1     1 1 8 my $str = shift;
35 1         147 $str =~ s/$_/$lookup->{$_}/g for keys %$lookup;
36 1         3 return $str
37             }
38              
39             sub deconvert {
40 1     1 1 336 my $str = shift;
41 1         154 $str =~ s/$lookup->{$_}/$_/g for keys %$lookup;
42 1         4 return $str
43             }
44              
45             1;
46              
47             __END__