| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Encode::MAB2; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 2 |  |  | 2 |  | 20497 | use strict; | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 69 |  | 
| 4 |  |  |  |  |  |  | our $VERSION = "0.07"; | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 2 |  |  | 2 |  | 1764 | use Encode (); | 
|  | 2 |  |  |  |  | 21920 |  | 
|  | 2 |  |  |  |  | 43 |  | 
| 7 | 2 |  |  | 2 |  | 959 | use Encode::MAB2table; | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 63 |  | 
| 8 | 2 |  |  | 2 |  | 2183 | use Unicode::Normalize qw(NFC); | 
|  | 2 |  |  |  |  | 558216 |  | 
|  | 2 |  |  |  |  | 369 |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 | 2 |  |  | 2 |  | 27 | use base qw(Encode::Encoding); | 
|  | 2 |  |  |  |  | 3 |  | 
|  | 2 |  |  |  |  | 962 |  | 
| 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 | 991 | 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 |  |  |  | 38 | $str =~ s{($combinings+)(.)}{($2 eq "\xf5" ? "i" : $2) . $1}ge; #}; | 
|  | 9 |  |  |  |  | 45 |  | 
| 21 | 3 | 50 |  |  |  | 11 | 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__ |