File Coverage

blib/lib/Language/Indonesia.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1             package Indonesia;
2 1     1   202359 use Filter::Simple;
  1         235263  
  1         6  
3 1     1   51 use strict;
  1         1  
  1         529  
4              
5              
6             our $VERSION = '0.0.2';
7              
8             FILTER{
9              
10             my %scalar_string = (
11             'panjang' => 'length',
12             'potong' => 'chop',
13             'potongkan' => 'chomp',
14             'karakter' => 'chr',
15             'sandi' => 'crypt',
16             'huruf kecil' => 'lc',
17             'huruf besar' => 'uc',
18             'ordinal' => 'ord',
19             'pak' => 'pack',
20             'balikan' => 'reverse',
21             'sub string' => 'substr',
22             'cetak' => 'print',
23             'format_cetakan' => 'printf'
24             );
25              
26             my %function = (
27             'absolut' => 'abs',
28             'tangen' => 'atan2',
29             'kosinus' => 'cos',
30             'pangkat' => 'exp',
31             'heksadesimal' => 'hex',
32             'integer' => 'int',
33             'logaritma' => 'log',
34             'oktal' => 'oct',
35             'acak' => 'rand',
36             'sinus' => 'sin',
37             'akar' => 'sqrt',
38             'acak_seed' => 'srand'
39             );
40              
41             my %func_array = (
42             'ambil' => 'pop',
43             'tambah' => 'push',
44             'pindah' => 'shift',
45             'sambung' => 'splice'
46             # '' => 'unshift'
47             );
48              
49             my %list_data = (
50             # '' => 'grep',
51             'gabung' => 'join',
52             # '' => 'map',
53             # '' => 'qw/STRING/',
54             'urut' => 'sort',
55             # '' => 'unpack'
56             );
57              
58             my %func_hash = (
59             'hapus' => 'delete',
60             'setiap' => 'each',
61             'ada' => 'exists',
62             'kunci' => 'keys',
63             'nilai' => 'values'
64             );
65              
66             my %scope = (
67             'panggil' => 'caller',
68             # '' => 'import',
69             # 'lokal' => 'local',
70             'lokal' => 'my',
71             # '' => 'our',
72             'paket' => 'package',
73             'gunakan' => 'use'
74             );
75              
76             my %module = (
77             'tidak' => 'no', # 'tidak' means 'no', but it will confuse others, especially Indonesian
78             'perlu' => 'require',
79             );
80              
81             my $i;
82              
83             foreach $i(keys %scalar_string){
84             s/\b$i\s*(.*?);/$scalar_string{$i} $1;/g;
85             }
86              
87             foreach $i(keys %function){
88             s/\b$i\s*(.*?);/$function{$i} $1;/g;
89             }
90              
91             foreach $i(keys %func_array){
92             s/\b$i\s*(.*?);/$func_array{$i} $1;/g;
93             }
94              
95              
96              
97              
98             s/\bjika\s*?\(((.|\n)*?)\)\s*?\{((.|\n)*?)\}/if($1){$3}/g;
99             s/\bketika\s*?\((.*?)\)\s*?\{((.|\n)*?)\}/while($1){$2}/g;
100             s/\blakukan((.|\n)*?)\}/do $1}/g;
101             s/\blakukan\s*(.*?);/do $1;/g;
102             s/\buntuk\s*?\(.*?\)\s*?\{(.*?)\}//g;
103              
104             };
105              
106             1;
107              
108              
109              
110             =head1 NAME
111              
112             Language::Indonesia - Write Perl program in Bahasa Indonesia.
113              
114             =head1 SYNOPSIS
115              
116             use Language::Indonesia;
117              
118             =head1 DESCRIPTION
119              
120             This module will help a lot of Indonesian programmers (most of them
121             aren't good enough in english) to write Perl program in Bahasa Indonesia.
122              
123             The linguistic principles behind Language::Indonesia are described in:
124              
125             http://www.anti-php.net/~daniels/index.pl?_work=indonesia
126              
127             =begin html
128              
129            
 
130             Conversion table:
131            
132             Bahasa Indonesia perlfunc
133             ========= =======
134             cetak print
135             format_cetakan printf
136             potongkan chomp
137             potong chop
138             untuk for
139             selagi while
140             lakukan do
141             etc.
142              
143            
144              
145             There's a lot of ambiguity in this module, for example:
146              
147            
 
148             tidak strict; # no strict; ?
149            
150              
151             Will confuse Indonesian programmers, I think. :-)
152              
153             =end html
154              
155             =head1 BUGS
156              
157             Not all Perl built-in function implemented.
158              
159             =head1 AUTHOR
160              
161             Daniel Sirait Edns@cpan.orgE
162              
163             =head1 COPYRIGHT AND LICENSE
164              
165             Copyright (C) 2006 by Daniel Sirait
166              
167             This library is free software; you can redistribute it and/or modify
168             it under the same terms as Perl itself, either Perl version 5.8.7 or,
169             at your option, any later version of Perl 5 you may have available.
170              
171              
172             =cut
173              
174