Korean/NKR_1992.pm

filter: Statementstmt 70.8% 34 / 48 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 63.6% 7 / 11 Podpod 50.0% 2 / 4 totaltotal 64.1% 43 / 67 CC 3 SCAR 9.9
CC
3
Cov
65%
encode
6.0
decode
6.0
enmode
2.0
CRAP 2.7
« Korean/MRR.pm ↑ Summary Korean/SKR_1959.pm »
1 # Encoding of Korean: North Korean Romanization 1992
2  
3 # $Id: NKR_1992.pm,v 1.7 2007/11/29 14:25:31 you Exp $
4  
5 package Encode::Korean::NKR_1992;
6  
7 1 our $VERSION = do { q$Revision: 1.7 $ =~ /\d+\.(\d+)/; sprintf "%.2f", $1 / 100 };
8  
9 1 ▶use 5.008008;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 ▶use Encode::Encoding;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use base qw(Encode::Encoding);
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 1 __PACKAGE__->Define(qw/nkr-1992 nkr1992 nkr/);
18  
19 1 ▶sub import {
Subroutine import: called CC=1 SCAR=0.0
20 1 require Encode;
21 1 Encode->export_to_level(1,@_);
22 }
23  
24 # = Encoding =
25 1 ▶use Encode::Korean::TransliteratorGenerator;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 # == RULES ==
28 1 my $nkr = Encode::Korean::TransliteratorGenerator->new();
29  
30 1 $nkr->consonants(qw(k kk n t tt r m p pp s ss ng ts tss tsh kh th ph h));
31 1 $nkr->vowels(
32 "a",
33 "ae",
34 "ya",
35 "yae",
36 "\x{014F}", # latin small letter with breve (ŏ)
37 "e",
38 "y\x{014F}",
39 "ye",
40 "o",
41 "wa",
42 "wae",
43 "oe",
44 "yo",
45 "u",
46 "w\x{014F}",
47 "we",
48 "wi",
49 "yu",
50 "\x{016D}", # latin small letter u with breve (ŭ)
51 "\x{016D}y",
52 "i"
53 );
54 1 $nkr->el('l');
55 1 $nkr->ell('ll');
56 1 $nkr->naught('.');
57 1 $nkr->sep('.');
58 1 $nkr->make();
59  
60 # == MODES ==
61 1 $nkr->enmode('greedy');
62 1 $nkr->demode('greedy');
63  
64 0 ▶sub enmode {
Subroutine enmode: not called CC=1 SCAR=6.9
Pod undocumented
65 0 my $class = shift;
66 0 my($mode) = @_;
67 0 $nkr->enmode($mode);
68 }
69  
70 0 ▶sub demode {
Subroutine demode: not called CC=1 SCAR=6.9
Pod undocumented
71 0 my $class = shift;
72 0 my($mode) = @_;
73 0 $nkr->demode($mode);
74 }
75  
76 # == METHODS ==
77 # === encode ===
78 # * encode($string [,$check])
79 # * Encodes
80 # unicode hangul syllables (Perl internal string)
81 # into NKR transliteration (octets)
82 0 ▶sub encode ($$;$) {
Subroutine encode: not called CC=2 SCAR=17.9
Pod documented
83 0 my ($obj, $str, $chk) = @_;
84 0 my $tr = $nkr->encode($str, $chk);
85 0 ▶ $_[1] = '' if $chk;
Branch: 1 branch
BranchTrueFalseTotal
if $chk 0 0 0
86 0 return $tr;
87 }
88  
89 # === decode ===
90 # * decode($octets [,$check])
91 # * Decodes
92 # NKR transliteration (octets)
93 # into unicode hangul syllables (Perl internal string)
94 0 ▶sub decode ($$;$) {
Subroutine decode: not called CC=2 SCAR=17.9
Pod documented
95 0 my ($obj, $str, $chk) = @_;
96 0 my $han = $nkr->decode($str, $chk);
97 0 ▶ $_[1] = '' if $chk;
Branch: 1 branch
BranchTrueFalseTotal
if $chk 0 0 0
98 0 return $han;
99 }
100  
101 # === cat_decode ===
102 # * Needs to work with encoding pragma
103 # * cat_decode($destination, $octets, $offset, $terminator [,$check])
104  
105  
106 1 1;
107 __END__
« Korean/MRR.pm ↑ Summary Korean/SKR_1959.pm »