File Coverage

blib/lib/Wikibase/Datatype/Value.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 0 1 0.0
total 20 21 95.2


line stmt bran cond sub pod time code
1             package Wikibase::Datatype::Value;
2              
3 243     243   542806 use strict;
  243         920  
  243         6901  
4 243     243   1657 use warnings;
  243         488  
  243         6686  
5              
6 243     243   3087 use Mo qw(build is);
  243         2462  
  243         1417  
7 243     243   135769 use Mo::utils qw(check_required);
  243         180617  
  243         19443  
8              
9             our $VERSION = 0.31;
10              
11             has value => (
12             is => 'ro',
13             );
14              
15             has type => (
16             'is' => 'ro',
17             );
18              
19             sub BUILD {
20 440     440 0 143240 my $self = shift;
21              
22 440         1620 check_required($self, 'value');
23              
24 431         4063 return;
25             }
26              
27             1;
28              
29             __END__
30              
31             =pod
32              
33             =encoding utf8
34              
35             =head1 NAME
36              
37             Wikibase::Datatype::Value - Wikibase value datatype.
38              
39             =head1 SYNOPSIS
40              
41             use Wikibase::Datatype::Value;
42              
43             my $obj = Wikibase::Datatype::Value->new(%params);
44             my $type = $obj->type;
45             my $value = $obj->value;
46              
47             =head1 DESCRIPTION
48              
49             This datatype is base class for all Value datatypes.
50              
51             =head1 METHODS
52              
53             =head2 C<new>
54              
55             my $obj = Wikibase::Datatype::Value->new(%params);
56              
57             Constructor.
58              
59             Returns instance of object.
60              
61             =over 8
62              
63             =item * C<type>
64              
65             Type of instance.
66             Default value is undef.
67              
68             =item * C<value>
69              
70             Value of instance.
71             Parameter is required.
72              
73             =back
74              
75             =head2 C<type>
76              
77             my $type = $obj->type;
78              
79             Get type.
80              
81             Returns string.
82              
83             =head2 C<value>
84              
85             my $value = $obj->value;
86              
87             Get value.
88              
89             Returns string.
90              
91             =head1 ERRORS
92              
93             new():
94             From Mo::utils::check_required():
95             Parameter 'value' is required.
96             Parameter 'type' is required.
97              
98             =head1 EXAMPLE
99              
100             =for comment filename=create_and_print_value.pl
101              
102             use strict;
103             use warnings;
104              
105             use Wikibase::Datatype::Value;
106              
107             # Object.
108             my $obj = Wikibase::Datatype::Value->new(
109             'value' => 'foo',
110             'type' => 'string',
111             );
112              
113             # Get value.
114             my $value = $obj->value;
115              
116             # Get type.
117             my $type = $obj->type;
118              
119             # Print out.
120             print "Value: $value\n";
121             print "Type: $type\n";
122              
123             # Output:
124             # Value: foo
125             # Type: string
126              
127             =head1 DEPENDENCIES
128              
129             L<Mo>,
130             L<Mo::utils>.
131              
132             =head1 SEE ALSO
133              
134             =over
135              
136             =item L<Wikibase::Datatype::Value::Globecoordinate>
137              
138             Wikibase globe coordinate value datatype.
139              
140             =item L<Wikibase::Datatype::Value::Item>
141              
142             Wikibase item value datatype.
143              
144             =item L<Wikibase::Datatype::Value::Monolingual>
145              
146             Wikibase monolingual value datatype.
147              
148             =item L<Wikibase::Datatype::Value::Property>
149              
150             Wikibase property value datatype.
151              
152             =item L<Wikibase::Datatype::Value::Quantity>
153              
154             Wikibase quantity value datatype.
155              
156             =item L<Wikibase::Datatype::Value::String>
157              
158             Wikibase string value datatype.
159              
160             =item L<Wikibase::Datatype::Value::Time>
161              
162             Wikibase time value datatype.
163              
164             =back
165              
166             =head1 REPOSITORY
167              
168             L<https://github.com/michal-josef-spacek/Wikibase-Datatype>
169              
170             =head1 AUTHOR
171              
172             Michal Josef Špaček L<mailto:skim@cpan.org>
173              
174             L<http://skim.cz>
175              
176             =head1 LICENSE AND COPYRIGHT
177              
178             © 2020-2023 Michal Josef Špaček
179              
180             BSD 2-Clause License
181              
182             =head1 VERSION
183              
184             0.31
185              
186             =cut