line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Lingua/UK/Jcuken.pm |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Copyright (c) 2006-2008 Serguei Trouchelle. All rights reserved. |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify it |
6
|
|
|
|
|
|
|
# under the same terms as Perl itself. |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# History: |
9
|
|
|
|
|
|
|
# 1.04 2008/02/26 use Encode instead of Text::Iconv |
10
|
|
|
|
|
|
|
# 1.02 2007/02/04 Quality update (Test::Pod, Test::Pod::Coverage) |
11
|
|
|
|
|
|
|
# 1.01 2006/11/15 Initial revision |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Lingua::UK::Jcuken -- Conversion between QWERTY and JCUKEN keys in Ukrainian |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 SYNOPSIS |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
use Lingua::UK::Jcuken qw/ jcu2qwe qwe2jcu /; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
print qwe2jcu('qwerty', 'koi8-r'); # prints "jcuken" in koi8-r |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Lingua::UK::Jcuken can be used for conversion between two layouts on Ukrainian keyboards. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 METHODS |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=cut |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
package Lingua::UK::Jcuken; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
require Exporter; |
34
|
5
|
|
|
5
|
|
53717
|
use Config; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
240
|
|
35
|
|
|
|
|
|
|
|
36
|
5
|
|
|
5
|
|
28
|
use strict; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
1372
|
|
37
|
5
|
|
|
5
|
|
29
|
use warnings; |
|
5
|
|
|
|
|
31
|
|
|
5
|
|
|
|
|
168
|
|
38
|
|
|
|
|
|
|
|
39
|
5
|
|
|
5
|
|
5388
|
use Encode; |
|
5
|
|
|
|
|
67056
|
|
|
5
|
|
|
|
|
2427
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
our @EXPORT = qw/ /; |
42
|
|
|
|
|
|
|
our @EXPORT_OK = qw/ jcu2qwe qwe2jcu /; |
43
|
|
|
|
|
|
|
our %EXPORT_TAGS = qw / /; |
44
|
|
|
|
|
|
|
our @ISA = qw/Exporter/; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
our $VERSION = "1.04"; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my $table = q!1 1 |
49
|
|
|
|
|
|
|
q é |
50
|
|
|
|
|
|
|
w ö |
51
|
|
|
|
|
|
|
e ó |
52
|
|
|
|
|
|
|
r ê |
53
|
|
|
|
|
|
|
t å |
54
|
|
|
|
|
|
|
y í |
55
|
|
|
|
|
|
|
u ã |
56
|
|
|
|
|
|
|
i ø |
57
|
|
|
|
|
|
|
o ù |
58
|
|
|
|
|
|
|
p ç |
59
|
|
|
|
|
|
|
[ õ |
60
|
|
|
|
|
|
|
] ¿ |
61
|
|
|
|
|
|
|
a ô |
62
|
|
|
|
|
|
|
s ³ |
63
|
|
|
|
|
|
|
d â |
64
|
|
|
|
|
|
|
f à |
65
|
|
|
|
|
|
|
g ï |
66
|
|
|
|
|
|
|
h ð |
67
|
|
|
|
|
|
|
j î |
68
|
|
|
|
|
|
|
k ë |
69
|
|
|
|
|
|
|
l ä |
70
|
|
|
|
|
|
|
; æ |
71
|
|
|
|
|
|
|
' º |
72
|
|
|
|
|
|
|
z ÿ |
73
|
|
|
|
|
|
|
x ÷ |
74
|
|
|
|
|
|
|
c ñ |
75
|
|
|
|
|
|
|
v ì |
76
|
|
|
|
|
|
|
b è |
77
|
|
|
|
|
|
|
n ò |
78
|
|
|
|
|
|
|
m ü |
79
|
|
|
|
|
|
|
, á |
80
|
|
|
|
|
|
|
. þ |
81
|
|
|
|
|
|
|
/ . |
82
|
|
|
|
|
|
|
` ¸ |
83
|
|
|
|
|
|
|
Q É |
84
|
|
|
|
|
|
|
W Ö |
85
|
|
|
|
|
|
|
E Ó |
86
|
|
|
|
|
|
|
R Ê |
87
|
|
|
|
|
|
|
T Å |
88
|
|
|
|
|
|
|
Y Í |
89
|
|
|
|
|
|
|
U Ã |
90
|
|
|
|
|
|
|
I Ø |
91
|
|
|
|
|
|
|
O Ù |
92
|
|
|
|
|
|
|
P Ç |
93
|
|
|
|
|
|
|
{ Õ |
94
|
|
|
|
|
|
|
} ¯ |
95
|
|
|
|
|
|
|
A Ô |
96
|
|
|
|
|
|
|
S ² |
97
|
|
|
|
|
|
|
D Â |
98
|
|
|
|
|
|
|
F À |
99
|
|
|
|
|
|
|
G Ï |
100
|
|
|
|
|
|
|
H Ð |
101
|
|
|
|
|
|
|
J Î |
102
|
|
|
|
|
|
|
K Ë |
103
|
|
|
|
|
|
|
L Ä |
104
|
|
|
|
|
|
|
: Æ |
105
|
|
|
|
|
|
|
" ª |
106
|
|
|
|
|
|
|
Z ß |
107
|
|
|
|
|
|
|
X × |
108
|
|
|
|
|
|
|
C Ñ |
109
|
|
|
|
|
|
|
V Ì |
110
|
|
|
|
|
|
|
B È |
111
|
|
|
|
|
|
|
N Ò |
112
|
|
|
|
|
|
|
M Ü |
113
|
|
|
|
|
|
|
< Á |
114
|
|
|
|
|
|
|
> Þ |
115
|
|
|
|
|
|
|
? . |
116
|
|
|
|
|
|
|
~ ¨ |
117
|
|
|
|
|
|
|
2 2!; |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
our %qwe2jcu = split /\s+/, $table; |
120
|
|
|
|
|
|
|
our %jcu2qwe = reverse split /\s+/, $table; |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head2 jcu2qwe ( $string, [ $encoding ]) |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
This method converts $string from Jcuken to Qwerty. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Optional $encoding parameter allows to specify $string's encoding (default is 'windows-1251') |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub jcu2qwe { |
131
|
5
|
|
|
5
|
1
|
27
|
my $val = shift; |
132
|
5
|
|
|
|
|
14
|
my $enc = shift; |
133
|
5
|
100
|
|
|
|
36
|
Encode::from_to($val, $enc, 'windows-1251') if $enc; |
134
|
5
|
|
|
|
|
9973
|
my $res = ''; |
135
|
5
|
|
|
|
|
43
|
foreach (split //, $val) { |
136
|
30
|
100
|
|
|
|
360
|
$_ = $jcu2qwe{$_} if $jcu2qwe{$_}; |
137
|
30
|
|
|
|
|
65
|
$res .= $_; |
138
|
|
|
|
|
|
|
} |
139
|
5
|
|
|
|
|
49
|
return $res; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head2 qwe2jcu ( $string, [ $encoding ]) |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
This method converts $string from Qwerty to Jcuken. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Optional $encoding parameter allows to specify result encoding (default is 'windows-1251'). |
147
|
|
|
|
|
|
|
It is also used as $string encoding if you have cyrillic in it. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=cut |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
sub qwe2jcu { |
152
|
5
|
|
|
5
|
1
|
22
|
my $val = shift; |
153
|
5
|
|
|
|
|
9
|
my $enc = shift; |
154
|
5
|
100
|
|
|
|
26
|
Encode::from_to($val, $enc, 'windows-1251') if $enc; |
155
|
5
|
100
|
|
|
|
8547
|
$enc = 'windows-1251' unless $enc; |
156
|
5
|
|
|
|
|
8
|
my $res = ''; |
157
|
5
|
|
|
|
|
20
|
foreach (split //, $val) { |
158
|
30
|
100
|
|
|
|
127
|
$_ = $qwe2jcu{$_} if $qwe2jcu{$_}; |
159
|
30
|
|
|
|
|
66
|
Encode::from_to($_, 'windows-1251', $enc); |
160
|
30
|
|
|
|
|
1218
|
$res .= $_; |
161
|
|
|
|
|
|
|
} |
162
|
5
|
|
|
|
|
33
|
return $res; |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
1; |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head1 AUTHORS |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Serguei Trouchelle EFE |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head1 COPYRIGHT |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Copyright (c) 2006-2008 Serguei Trouchelle. All rights reserved. |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
176
|
|
|
|
|
|
|
under the same terms as Perl itself. |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=cut |