line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Wikibase::Datatype::Value::Item; |
2
|
|
|
|
|
|
|
|
3
|
134
|
|
|
134
|
|
494205
|
use strict; |
|
134
|
|
|
|
|
369
|
|
|
134
|
|
|
|
|
3870
|
|
4
|
134
|
|
|
134
|
|
959
|
use warnings; |
|
134
|
|
|
|
|
265
|
|
|
134
|
|
|
|
|
3517
|
|
5
|
|
|
|
|
|
|
|
6
|
134
|
|
|
134
|
|
14483
|
use Mo qw(build); |
|
134
|
|
|
|
|
17654
|
|
|
134
|
|
|
|
|
1182
|
|
7
|
134
|
|
|
134
|
|
59841
|
use Wikibase::Datatype::Utils qw(check_entity); |
|
134
|
|
|
|
|
381
|
|
|
134
|
|
|
|
|
11453
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = 0.31; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
extends 'Wikibase::Datatype::Value'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub type { |
14
|
1
|
|
|
1
|
1
|
9
|
return 'item'; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub BUILD { |
18
|
133
|
|
|
133
|
0
|
967
|
my $self = shift; |
19
|
|
|
|
|
|
|
|
20
|
133
|
|
|
|
|
553
|
check_entity($self, 'value'); |
21
|
|
|
|
|
|
|
|
22
|
132
|
|
|
|
|
261
|
return; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
1; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
__END__ |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=pod |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=encoding utf8 |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 NAME |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Wikibase::Datatype::Value::Item - Wikibase item value datatype. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 SYNOPSIS |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
use Wikibase::Datatype::Value::Item; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my $obj = Wikibase::Datatype::Value::Item->new(%params); |
42
|
|
|
|
|
|
|
my $type = $obj->type; |
43
|
|
|
|
|
|
|
my $value = $obj->value; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 DESCRIPTION |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
This datatype is item class for representation of wikibase item (e.g. Q123). |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 METHODS |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 C<new> |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
my $obj = Wikibase::Datatype::Value::Item->new(%params); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Constructor. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Returns instance of object. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=over 8 |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=item * C<value> |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Value of instance. |
64
|
|
|
|
|
|
|
Parameter must be in form /^Q\d+$/ (regexp). |
65
|
|
|
|
|
|
|
Parameter is required. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=back |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 C<type> |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
my $type = $obj->type; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Get type. This is constant 'item'. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Returns string. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 C<value> |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
my $value = $obj->value; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Get value. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Returns string. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 ERRORS |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
new(): |
88
|
|
|
|
|
|
|
From Wikibase::Datatype::Utils::check_entity(): |
89
|
|
|
|
|
|
|
Parameter 'value' must begin with 'Q' and number after it. |
90
|
|
|
|
|
|
|
From Wikibase::Datatype::Value::new(): |
91
|
|
|
|
|
|
|
Parameter 'value' is required. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 EXAMPLE |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=for comment filename=create_and_print_value_item.pl |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
use strict; |
98
|
|
|
|
|
|
|
use warnings; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
use Wikibase::Datatype::Value::Item; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
# Object. |
103
|
|
|
|
|
|
|
my $obj = Wikibase::Datatype::Value::Item->new( |
104
|
|
|
|
|
|
|
'value' => 'Q123', |
105
|
|
|
|
|
|
|
); |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
# Get value. |
108
|
|
|
|
|
|
|
my $value = $obj->value; |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
# Get type. |
111
|
|
|
|
|
|
|
my $type = $obj->type; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
# Print out. |
114
|
|
|
|
|
|
|
print "Type: $type\n"; |
115
|
|
|
|
|
|
|
print "Value: $value\n"; |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
# Output: |
118
|
|
|
|
|
|
|
# Type: item |
119
|
|
|
|
|
|
|
# Value: Q123 |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
L<Error::Pure>, |
124
|
|
|
|
|
|
|
L<Mo>, |
125
|
|
|
|
|
|
|
L<Wikibase::Datatype::Utils>, |
126
|
|
|
|
|
|
|
L<Wikibase::Datatype::Value>. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 SEE ALSO |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=over |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=item L<Wikibase::Datatype::Value> |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Wikibase datatypes. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=back |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 REPOSITORY |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
L<https://github.com/michal-josef-spacek/Wikibase-Datatype> |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 AUTHOR |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Michal Josef Špaček L<mailto:skim@cpan.org> |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
L<http://skim.cz> |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
© 2020-2023 Michal Josef Špaček |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
BSD 2-Clause License |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head1 VERSION |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
0.31 |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=cut |