line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Wikibase::Datatype::Value::Monolingual; |
2
|
|
|
|
|
|
|
|
3
|
60
|
|
|
60
|
|
708496
|
use strict; |
|
60
|
|
|
|
|
200
|
|
|
60
|
|
|
|
|
1766
|
|
4
|
60
|
|
|
60
|
|
325
|
use warnings; |
|
60
|
|
|
|
|
149
|
|
|
60
|
|
|
|
|
1651
|
|
5
|
|
|
|
|
|
|
|
6
|
60
|
|
|
60
|
|
3136
|
use Mo qw(is); |
|
60
|
|
|
|
|
3196
|
|
|
60
|
|
|
|
|
361
|
|
7
|
60
|
|
|
60
|
|
28237
|
use Wikibase::Datatype::Utils qw(check_language); |
|
60
|
|
|
|
|
188
|
|
|
60
|
|
|
|
|
5800
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = 0.29; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
extends 'Wikibase::Datatype::Value'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has language => ( |
14
|
|
|
|
|
|
|
is => 'ro', |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub type { |
18
|
1
|
|
|
1
|
1
|
19
|
return 'monolingualtext'; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub BUILD { |
22
|
115
|
|
|
115
|
0
|
567
|
my $self = shift; |
23
|
|
|
|
|
|
|
|
24
|
115
|
100
|
|
|
|
393
|
if (! defined $self->{'language'}) { |
25
|
5
|
|
|
|
|
15
|
$self->{'language'} = 'en', |
26
|
|
|
|
|
|
|
} |
27
|
115
|
|
|
|
|
432
|
check_language($self, 'language'); |
28
|
|
|
|
|
|
|
|
29
|
113
|
|
|
|
|
350
|
return; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
__END__ |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=pod |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=encoding utf8 |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 NAME |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Wikibase::Datatype::Value::Monolingual - Wikibase monolingual value datatype. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 SYNOPSIS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
use Wikibase::Datatype::Value::Monolingual; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my $obj = Wikibase::Datatype::Value::Monolingual->new(%params); |
49
|
|
|
|
|
|
|
my $language = $obj->language; |
50
|
|
|
|
|
|
|
my $type = $obj->type; |
51
|
|
|
|
|
|
|
my $value = $obj->value; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 DESCRIPTION |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
This datatype is string class for representation of translatable string. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 METHODS |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 C<new> |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my $obj = Wikibase::Datatype::Value::Monolingual->new(%params); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Constructor. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Returns instance of object. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=over 8 |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=item * C<language> |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Language shortcut. |
72
|
|
|
|
|
|
|
Parameter is optional. |
73
|
|
|
|
|
|
|
Value is checked to ISO 639-1 language code. |
74
|
|
|
|
|
|
|
Default value is 'en'. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item * C<value> |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Value of instance. |
79
|
|
|
|
|
|
|
Parameter is required. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=back |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 C<language> |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
my $language = $obj->language; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Get language shortcut. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Returns string. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 C<type> |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
my $type = $obj->type; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Get type. This is constant 'monolingualtext'. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Returns string. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 C<value> |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
my $value = $obj->value; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Get value. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Returns string. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 ERRORS |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
new(): |
110
|
|
|
|
|
|
|
From Wikibase::Datatype::Value::new(): |
111
|
|
|
|
|
|
|
Parameter 'value' is required. |
112
|
|
|
|
|
|
|
From Wikibase::Datatype::Utils::check_language(): |
113
|
|
|
|
|
|
|
Language code '%s' isn't ISO 639-1 code. |
114
|
|
|
|
|
|
|
Language with ISO 639-1 code '%s' doesn't exist. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 EXAMPLE |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=for comment filename=create_and_print_value_monolingual.pl |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
use strict; |
121
|
|
|
|
|
|
|
use warnings; |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
use Wikibase::Datatype::Value::Monolingual; |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
# Object. |
126
|
|
|
|
|
|
|
my $obj = Wikibase::Datatype::Value::Monolingual->new( |
127
|
|
|
|
|
|
|
'language' => 'en', |
128
|
|
|
|
|
|
|
'value' => 'English text', |
129
|
|
|
|
|
|
|
); |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
# Get language. |
132
|
|
|
|
|
|
|
my $language = $obj->language; |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
# Get type. |
135
|
|
|
|
|
|
|
my $type = $obj->type; |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
# Get value. |
138
|
|
|
|
|
|
|
my $value = $obj->value; |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
# Print out. |
141
|
|
|
|
|
|
|
print "Language: $language\n"; |
142
|
|
|
|
|
|
|
print "Type: $type\n"; |
143
|
|
|
|
|
|
|
print "Value: $value\n"; |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
# Output: |
146
|
|
|
|
|
|
|
# Language: en |
147
|
|
|
|
|
|
|
# Type: monolingualtext |
148
|
|
|
|
|
|
|
# Value: English text |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
L<Mo>, |
153
|
|
|
|
|
|
|
L<Wikibase::Datatype::Value>. |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head1 SEE ALSO |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=over |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=item L<Wikibase::Datatype::Value> |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Wikibase datatypes. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=back |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head1 REPOSITORY |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
L<https://github.com/michal-josef-spacek/Wikibase-Datatype> |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head1 AUTHOR |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
Michal Josef Špaček L<mailto:skim@cpan.org> |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
L<http://skim.cz> |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
© 2020-2023 Michal Josef Špaček |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
BSD 2-Clause License |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head1 VERSION |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
0.29 |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=cut |