Korean/Yale.pm

filter: Statementstmt 69.5% 32 / 46 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 63.6% 7 / 11 Podpod 50.0% 2 / 4 totaltotal 63.0% 41 / 65 CC 3 SCAR 9.9
CC
3
Cov
64%
encode
6.0
decode
6.0
enmode
2.0
CRAP 2.7
« Korean/SKR_1984.pm ↑ Summary Korean/HSR.pm »
1 # Encoding of Korean: Yale Romanization System for Korean Language
2  
3 # $Id: Yale.pm,v 1.6 2007/11/29 14:25:31 you Exp $
4  
5 package Encode::Korean::Yale;
6  
7 1 our $VERSION = do { q$Revision: 1.6 $ =~ /\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/korean-yale yale/);
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  
25 # == RULES ==
26 1 ▶use Encode::Korean::TransliteratorGenerator;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 1 my $yale = Encode::Korean::TransliteratorGenerator->new();
28  
29 1 $yale->consonants(qw(k kk n t tt l m p pp s ss ng c cc ch kh th ph h));
30 1 $yale->vowels(qw(a ay ya yay e ey ye yey o wa way oy yo wu we wey wi yu u uy i));
31 #$yale->el('l');
32 #$yale->ell('ll');
33 1 $yale->naught('.');
34 1 $yale->sep('.');
35 1 $yale->make();
36  
37  
38 # == MODES ==
39 1 $yale->enmode('greedy');
40 1 $yale->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 $yale->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 $yale->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 = $yale->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 = $yale->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 1 1;
83 __END__
« Korean/SKR_1984.pm ↑ Summary Korean/HSR.pm »