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