| 1 | package Encode::MAB2; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | our $VERSION = "0.09"; # must stay in sync with Encode::MAB2table | |||||||||
| 5 | |||||||||||
| 6 | 2 | ▶ | use Encode (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 2 | ▶ | use Encode::MAB2table; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 2 | ▶ | use Unicode::Normalize qw(NFC); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 2 | ▶ | use base qw(Encode::Encoding); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 2 | __PACKAGE__->Define('MAB2', 'mab2'); | |||||||||
| 12 | |||||||||||
| 13 | 0 | ▶ | sub needs_lines {1} | ||||||||
|
Subroutine
needs_lines: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 14 | |||||||||||
| 15 | 2 | our $combinings = qr/[\xc0-\xdb\xdd-\xdf]/; | |||||||||
| 16 | 3 | ▶ | sub decode { | ||||||||
|
Subroutine
decode: called CC=5 SCAR=19.7
Pod
documented
| |||||||||||
| 17 | 3 | my($obj, $str, $chk) = @_; | |||||||||
| 18 | 3 | ▶ | return unless defined $str; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | 3 | $str =~ s{\xcd\xc9}{\xcd}g; # Fehler bei Heged"us, Erd"os und Mez"o | |||||||||
| 20 | 3 | ▶ | $str =~ s{($combinings+)(.)}{($2 eq "\xf5" ? "i" : $2) . $1}ge; #}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | 3 | ▶ | if ($chk) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | 0 | ▶ | if ($str =~ s/($combinings+)\z//) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | 0 | $_[1] = $1; # we have 'sub needs_lines {1}', so this should | |||||||||
| 24 | # never happen | ||||||||||
| 25 | } else { | ||||||||||
| 26 | 0 | $_[1] = ''; | |||||||||
| 27 | } | ||||||||||
| 28 | } | ||||||||||
| 29 | 3 | NFC(Encode::decode("MAB2table",$str)); | |||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | 2 | 1; | |||||||||
| 33 | __END__ | ||||||||||