| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#! /bin/false |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# vim: set autoindent shiftwidth=4 tabstop=4: |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# Virtual base class for Locale::Recode converters. |
|
6
|
|
|
|
|
|
|
# Copyright (C) 2002-2026 Guido Flohr <guido.flohr@cantanea.com>, |
|
7
|
|
|
|
|
|
|
# all rights reserved. |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# This program is free software: you can redistribute it and/or modify |
|
10
|
|
|
|
|
|
|
# it under the terms of the GNU General Public License as published by |
|
11
|
|
|
|
|
|
|
# the Free Software Foundation; either version 3 of the License, or |
|
12
|
|
|
|
|
|
|
# (at your option) any later version. |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful, |
|
15
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
17
|
|
|
|
|
|
|
# GNU General Public License for more details. |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License |
|
20
|
|
|
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
package Locale::RecodeData; |
|
23
|
|
|
|
|
|
|
|
|
24
|
138
|
|
|
138
|
|
1183
|
use strict; |
|
|
138
|
|
|
|
|
239
|
|
|
|
138
|
|
|
|
|
17755
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub new |
|
27
|
|
|
|
|
|
|
{ |
|
28
|
549
|
|
|
549
|
1
|
2657
|
my ($class, %args) = @_; |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
bless { |
|
31
|
|
|
|
|
|
|
_from => $args{from}, |
|
32
|
|
|
|
|
|
|
_to => $args{to}, |
|
33
|
549
|
|
|
|
|
3348
|
}, $class; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub _getError |
|
37
|
|
|
|
|
|
|
{ |
|
38
|
0
|
|
|
0
|
|
|
shift->{_error}; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 NAME |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Locale::RecodeData - Abstract Base Class for Charset Converters |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# For compatibility with Perl 5.005 and earlier, you must |
|
52
|
|
|
|
|
|
|
# *use* the module before inheriting from it! |
|
53
|
|
|
|
|
|
|
use qw (Locale::RecodeData); |
|
54
|
|
|
|
|
|
|
use base qw (Locale::RecodeData); |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
The module B<Locale::RecodeData> serves as an abstract base class to |
|
59
|
|
|
|
|
|
|
all converters used by Locale::Recode(3). |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Adding new conversion modules is currently not straightforward, and |
|
62
|
|
|
|
|
|
|
you will have to edit the sources of some modules for that purpose. |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
First, you have to add your new converter class to the list found |
|
65
|
|
|
|
|
|
|
in Locale::_Conversions(3), so that Locale::Recode(3) knows about |
|
66
|
|
|
|
|
|
|
its presence. If there are valid aliases for the codeset of your |
|
67
|
|
|
|
|
|
|
converter, you will also have to edit Locale::_Aliases(3). |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Finally, you have to implement the (protected) conversion routine |
|
70
|
|
|
|
|
|
|
_recode(). See below (L<"INTERFACE")> for details. |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=over 4 |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item B<new (from =E<gt> FROM_CODESET, to =E<gt> TO_CODESET)> |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
The constructor takes two (named) arguments: |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=over 8 |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item B<from> |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
The canonical name of the source codeset. Aliases have already been |
|
85
|
|
|
|
|
|
|
resolved and the name is converted to uppercase. |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item B<to> |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
The canonical name of the destination codeset. Aliases have already been |
|
90
|
|
|
|
|
|
|
resolved and the name is converted to uppercase. |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=back |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
You normally don't have to implement the constructor. The default constructor |
|
95
|
|
|
|
|
|
|
implemented here will store the source and destination codesets in the |
|
96
|
|
|
|
|
|
|
protected members C<_from> and C<_to>. |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=back |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 METHODS |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
The class implements one method: |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=over 4 |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=item B<_getError> |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Returns the (protected) member C<_error>. |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=back |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 INTERFACE |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
New conversion classes must provide the following interface: |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=over 4 |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=item B<new (from =E<gt> FROM_CODESET, to =E<gt> TO_CODESET)> |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
The constructor takes two (named) arguments: |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=over 8 |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=item B<from> |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
The canonical name of the source codeset. Aliases have already been |
|
127
|
|
|
|
|
|
|
resolved and the name is converted to uppercase. |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=item B<to> |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
The canonical name of the destination codeset. Aliases have already been |
|
132
|
|
|
|
|
|
|
resolved and the name is converted to uppercase. |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=back |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=item B<_getError> |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Should return the last error (as a string) or false if there was no error. |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
This method is implemented in the base class already. |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=item B<_recode STRINGREF> |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Should convert the argument C<STRINGREF> in-place. In case of failure, |
|
145
|
|
|
|
|
|
|
return false, and make provisions that the method C<_getError()> returns |
|
146
|
|
|
|
|
|
|
an informative error message. |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=back |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 AUTHOR |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Copyright (C) 2002-2026 L<Guido Flohr|http://www.guido-flohr.net/> |
|
153
|
|
|
|
|
|
|
(L<mailto:guido.flohr@cantanea.com>), all rights reserved. See the source |
|
154
|
|
|
|
|
|
|
code for details!code for details! |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Locale::Recode::_Aliases(3pm), Locale::Recode::_Conversions(3pm), |
|
159
|
|
|
|
|
|
|
Locale::Recode(3pm), perl(1) |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=cut |
|
162
|
|
|
|
|
|
|
Local Variables: |
|
163
|
|
|
|
|
|
|
mode: perl |
|
164
|
|
|
|
|
|
|
perl-indent-level: 4 |
|
165
|
|
|
|
|
|
|
perl-continued-statement-offset: 4 |
|
166
|
|
|
|
|
|
|
perl-continued-brace-offset: 0 |
|
167
|
|
|
|
|
|
|
perl-brace-offset: -4 |
|
168
|
|
|
|
|
|
|
perl-brace-imaginary-offset: 0 |
|
169
|
|
|
|
|
|
|
perl-label-offset: -4 |
|
170
|
|
|
|
|
|
|
cperl-indent-level: 4 |
|
171
|
|
|
|
|
|
|
cperl-continued-statement-offset: 2 |
|
172
|
|
|
|
|
|
|
tab-width: 4 |
|
173
|
|
|
|
|
|
|
End: |