| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | # Encoding of Korean: South Korean Romanization 1959 | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | # $Id: SKR_1959.pm,v 1.5 2007/11/29 14:25:31 you Exp $ | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | package Encode::Korean::SKR_1959; | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | our $VERSION = do { q$Revision: 1.5 $ =~ /\d+\.(\d+)/; sprintf "%.2f", $1 / 100  }; | 
| 8 |  |  |  |  |  |  |  | 
| 9 | 1 |  |  | 1 |  | 33550 | use 5.008008; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 37 |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 | 1 |  |  | 1 |  | 5 | use strict; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 28 |  | 
| 12 | 1 |  |  | 1 |  | 4 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 47 |  | 
| 13 |  |  |  |  |  |  |  | 
| 14 | 1 |  |  | 1 |  | 885 | use Encode::Encoding; | 
|  | 1 |  |  |  |  | 12248 |  | 
|  | 1 |  |  |  |  | 52 |  | 
| 15 | 1 |  |  | 1 |  | 10 | use base qw(Encode::Encoding); | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 165 |  | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | __PACKAGE__->Define(qw/skr-1959 skr1959 1959-sk 1959sk/); | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | sub import { | 
| 20 | 1 |  |  | 1 |  | 17 | require Encode; | 
| 21 | 1 |  |  |  |  | 45 | Encode->export_to_level(1,@_); | 
| 22 |  |  |  |  |  |  | } | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | # == RULES == | 
| 26 | 1 |  |  | 1 |  | 710 | use Encode::Korean::TransliteratorGenerator; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 312 |  | 
| 27 |  |  |  |  |  |  | my $skr = Encode::Korean::TransliteratorGenerator->new(); | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | $skr->consonants(qw(g gg n d dd r m b bb s ss ng j jj ch k t p h)); | 
| 30 |  |  |  |  |  |  | $skr->vowels(qw(a ae ya yae eo e yeo ye o wa wae oe yo u weo we wi yu eu eui i)); | 
| 31 |  |  |  |  |  |  | $skr->el('l'); | 
| 32 |  |  |  |  |  |  | $skr->ell('ll'); | 
| 33 |  |  |  |  |  |  | $skr->naught('.'); | 
| 34 |  |  |  |  |  |  | $skr->sep(';'); | 
| 35 |  |  |  |  |  |  | $skr->make(); | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | # == MODES == | 
| 39 |  |  |  |  |  |  | $skr->enmode('greedy'); | 
| 40 |  |  |  |  |  |  | $skr->demode('greedy'); | 
| 41 |  |  |  |  |  |  | sub enmode { | 
| 42 | 0 |  |  | 0 | 0 |  | my $class = shift; | 
| 43 | 0 |  |  |  |  |  | my($mode) = @_; | 
| 44 | 0 |  |  |  |  |  | $skr->enmode($mode); | 
| 45 |  |  |  |  |  |  | } | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | sub demode { | 
| 48 | 0 |  |  | 0 | 0 |  | my $class = shift; | 
| 49 | 0 |  |  |  |  |  | my($mode) = @_; | 
| 50 | 0 |  |  |  |  |  | $skr->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 |  |  |  |  |  |  | sub encode ($$;$) { | 
| 60 | 0 |  |  | 0 | 1 |  | my ($obj, $str, $chk) = @_; | 
| 61 | 0 |  |  |  |  |  | my $tr = $skr->encode($str, $chk); | 
| 62 | 0 | 0 |  |  |  |  | $_[1] = '' if $chk; | 
| 63 | 0 |  |  |  |  |  | return $tr; | 
| 64 |  |  |  |  |  |  | } | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | # | 
| 67 |  |  |  |  |  |  | # === decode === | 
| 68 |  |  |  |  |  |  | # * decode($octets [,$check]) | 
| 69 |  |  |  |  |  |  | # * Decodes transliteration into unicode hangul syllables (Perl internal string) | 
| 70 |  |  |  |  |  |  | sub decode ($$;$) { | 
| 71 | 0 |  |  | 0 | 1 |  | my ($obj, $str, $chk) = @_; | 
| 72 | 0 |  |  |  |  |  | my $han = $skr->decode($str, $chk); | 
| 73 | 0 | 0 |  |  |  |  | $_[1] = '' if $chk; | 
| 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; | 
| 83 |  |  |  |  |  |  | __END__ |