File Coverage

blib/lib/Encode/MAB2.pm
Criterion Covered Total %
statement 22 26 84.6
branch 3 8 37.5
condition n/a
subroutine 6 7 85.7
pod 2 2 100.0
total 33 43 76.7


line stmt bran cond sub pod time code
1             package Encode::MAB2;
2              
3 2     2   20280 use strict;
  2         3  
  2         131  
4             our $VERSION = "0.08"; # must stay in sync with Encode::MAB2table
5              
6 2     2   1686 use Encode ();
  2         21859  
  2         44  
7 2     2   964 use Encode::MAB2table;
  2         6  
  2         65  
8 2     2   12364 use Unicode::Normalize qw(NFC);
  2         565925  
  2         389  
9              
10 2     2   28 use base qw(Encode::Encoding);
  2         4  
  2         924  
11             __PACKAGE__->Define('MAB2', 'mab2');
12              
13 0     0 1 0 sub needs_lines {1}
14              
15             our $combinings = qr/[\xc0-\xdb\xdd-\xdf]/;
16             sub decode {
17 3     3 1 1587 my($obj, $str, $chk) = @_;
18 3 50       10 return unless defined $str;
19 3         14 $str =~ s{\xcd\xc9}{\xcd}g; # Fehler bei Heged"us, Erd"os und Mez"o
20 3 50       42 $str =~ s{($combinings+)(.)}{($2 eq "\xf5" ? "i" : $2) . $1}ge; #};
  9         55  
21 3 50       9 if ($chk) {
22 0 0       0 if ($str =~ s/($combinings+)\z//) {
23 0         0 $_[1] = $1; # we have 'sub needs_lines {1}', so this should
24             # never happen
25             } else {
26 0         0 $_[1] = '';
27             }
28             }
29 3         11 NFC(Encode::decode("MAB2table",$str));
30             }
31              
32             1;
33             __END__