Korean/SKR_2000.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/SKR_1959.pm ↑ Summary
1 # Encoding of Korean: South Korean Romanization 2000
2 # (aka. Revised Romanization of Korean)
3  
4 # $Id: SKR_2000.pm,v 1.5 2007/11/29 14:25:31 you Exp $
5  
6 package Encode::Korean::SKR_2000;
7  
8 1 our $VERSION = do { q$Revision: 1.5 $ =~ /\d+\.(\d+)/; sprintf "%.2f", $1 / 100 };
9  
10 1 ▶use 5.008008;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 ▶use Encode::Encoding;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use base qw(Encode::Encoding);
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 __PACKAGE__->Define(qw/skr-2000 skr2000 skr/);
19  
20 1 ▶sub import {
Subroutine import: called CC=1 SCAR=0.0
21 1 require Encode;
22 1 Encode->export_to_level(1,@_);
23 }
24  
25  
26 # == RULES ==
27 1 ▶use Encode::Korean::TransliteratorGenerator;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 1 my $coder = Encode::Korean::TransliteratorGenerator->new();
29  
30 1 $coder->consonants(qw(g kk n d tt r m b pp s ss ng j jj ch k t p h));
31 1 $coder->vowels(qw(a ae ya yae eo e yeo ye o wa wae oe yo u wo we wi yu eu ui i));
32 1 $coder->el('l');
33 1 $coder->ell('ll');
34 1 $coder->naught('-');
35 1 $coder->sep('-');
36 1 $coder->make();
37  
38  
39 # == MODES ==
40 1 $coder->enmode('greedy');
41 1 $coder->demode('greedy');
42 0 ▶sub enmode {
Subroutine enmode: not called CC=1 SCAR=6.9
Pod undocumented
43 0 my $class = shift;
44 0 my($mode) = @_;
45 0 $coder->enmode($mode);
46 }
47  
48 0 ▶sub demode {
Subroutine demode: not called CC=1 SCAR=6.9
Pod undocumented
49 0 my $class = shift;
50 0 my($mode) = @_;
51 0 $coder->demode($mode);
52 }
53  
54  
55 # == METHODS ==
56 # === encode ===
57 # * encode($string [,$check])
58 # * Encodes unicode hangul syllables (Perl internal string)
59 # into transliterated (romanized) string
60 0 ▶sub encode ($$;$) {
Subroutine encode: not called CC=2 SCAR=17.9
Pod documented
61 0 my ($obj, $str, $chk) = @_;
62 0 my $tr = $coder->encode($str, $chk);
63 0 ▶ $_[1] = '' if $chk;
Branch: 1 branch
BranchTrueFalseTotal
if $chk 0 0 0
64 0 return $tr;
65 }
66  
67 #
68 # === decode ===
69 # * decode($octets [,$check])
70 # * Decodes transliteration into unicode hangul syllables (Perl internal string)
71 0 ▶sub decode ($$;$) {
Subroutine decode: not called CC=2 SCAR=17.9
Pod documented
72 0 my ($obj, $str, $chk) = @_;
73 0 my $han = $coder->decode($str, $chk);
74 0 ▶ $_[1] = '' if $chk;
Branch: 1 branch
BranchTrueFalseTotal
if $chk 0 0 0
75 0 return $han;
76 }
77  
78 # === cat_decode ===
79 # * Needs to work with encoding pragma
80 # * cat_decode($destination, $octets, $offset, $terminator [,$check])
81  
82  
83 1 1;
84 __END__
« Korean/SKR_1959.pm ↑ Summary