| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Locale::MakePhrase::Language; |
|
2
|
|
|
|
|
|
|
our $VERSION = 0.2; |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
Locale::MakePhrase::Language - base class for language-specific |
|
7
|
|
|
|
|
|
|
handling. |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
This is a base-class for language-specific implementation modules. |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
You only need to implement custom language objects, if there is |
|
14
|
|
|
|
|
|
|
something you cant do with a language rule, such as: |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=over 2 |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=item * |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
handling keyboard input in a language specific way |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=item * |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
display of formula's |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=back |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 API |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
The following methods are available: |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
|
33
|
|
|
|
|
|
|
|
|
34
|
8
|
|
|
8
|
|
777
|
use strict; |
|
|
8
|
|
|
|
|
14
|
|
|
|
8
|
|
|
|
|
252
|
|
|
35
|
8
|
|
|
8
|
|
41
|
use warnings; |
|
|
8
|
|
|
|
|
15
|
|
|
|
8
|
|
|
|
|
184
|
|
|
36
|
8
|
|
|
8
|
|
40
|
use utf8; |
|
|
8
|
|
|
|
|
13
|
|
|
|
8
|
|
|
|
|
270
|
|
|
37
|
8
|
|
|
8
|
|
182
|
use base qw(); |
|
|
8
|
|
|
|
|
14
|
|
|
|
8
|
|
|
|
|
1675
|
|
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
#-------------------------------------------------------------------------- |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 new() |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Construct an instance of this module; all arguments passed to the |
|
44
|
|
|
|
|
|
|
init() method. |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# Generic constructor |
|
49
|
|
|
|
|
|
|
sub new { |
|
50
|
7
|
|
|
7
|
1
|
17
|
my $proto = shift; |
|
51
|
7
|
|
33
|
|
|
52
|
my $class = ref($proto) || $proto; |
|
52
|
7
|
|
|
|
|
22
|
my $self = bless {}, $class; |
|
53
|
7
|
|
|
|
|
44
|
return $self->init(@_); |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 $self init([...]) |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Allow sub-classes a chance to control construction. |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
|
61
|
|
|
|
|
|
|
|
|
62
|
7
|
|
|
7
|
1
|
78
|
sub init { shift } |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 $string language() |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Returns the language tag of this modules' language. |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub language { |
|
71
|
0
|
|
|
0
|
1
|
|
my $lang = shift; |
|
72
|
0
|
|
|
|
|
|
$lang =~ s/.*::([a-z_]+)$/$1/; |
|
73
|
0
|
|
|
|
|
|
return $lang; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 boolean y_or_n($keypress) |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This methods is simply a stub which declares the signature. It is |
|
79
|
|
|
|
|
|
|
up the language specific module to implement the correct handling |
|
80
|
|
|
|
|
|
|
of the keypress'ed value. |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
For example, the L module implements |
|
83
|
|
|
|
|
|
|
a test for the B character; if B is pressed, a value of true is |
|
84
|
|
|
|
|
|
|
returned; any other key returns false. |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=cut |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# stub |
|
89
|
|
|
|
|
|
|
sub y_or_n { |
|
90
|
0
|
|
|
0
|
1
|
|
die "Must be implemented in a language specific sub-class"; |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |
|
94
|
|
|
|
|
|
|
__END__ |