File Coverage

blib/lib/Wikibase/Datatype/Value/String.pm
Criterion Covered Total %
statement 10 10 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 15 15 100.0


line stmt bran cond sub pod time code
1             package Wikibase::Datatype::Value::String;
2              
3 79     79   495305 use strict;
  79         219  
  79         2155  
4 79     79   414 use warnings;
  79         173  
  79         1834  
5              
6 79     79   2153 use Mo;
  79         2256  
  79         429  
7              
8             our $VERSION = 0.31;
9              
10             extends 'Wikibase::Datatype::Value';
11              
12             sub type {
13 1     1 1 9 return 'string';
14             }
15              
16             1;
17              
18             __END__
19              
20             =pod
21              
22             =encoding utf8
23              
24             =head1 NAME
25              
26             Wikibase::Datatype::Value::String - Wikibase string value datatype.
27              
28             =head1 SYNOPSIS
29              
30             use Wikibase::Datatype::Value::String;
31              
32             my $obj = Wikibase::Datatype::Value::String->new(%params);
33             my $type = $obj->type;
34             my $value = $obj->value;
35              
36             =head1 DESCRIPTION
37              
38             This datatype is string class for representation of common string. There are
39             upper datatypes as commonsMedia, external-id, geo-shape, math, musical-notation,
40             string, tabular-data and url, which uses this data type.
41              
42             =head1 METHODS
43              
44             =head2 C<new>
45              
46             my $obj = Wikibase::Datatype::Value::String->new(%params);
47              
48             Constructor.
49              
50             Returns instance of object.
51              
52             =over 8
53              
54             =item * C<value>
55              
56             Value of instance.
57             Parameter is required.
58              
59             =back
60              
61             =head2 C<type>
62              
63             my $type = $obj->type;
64              
65             Get type. This is constant 'string'.
66              
67             Returns string.
68              
69             =head2 C<value>
70              
71             my $value = $obj->value;
72              
73             Get value.
74              
75             Returns string.
76              
77             =head1 ERRORS
78              
79             new():
80             From Wikibase::Datatype::Value::new():
81             Parameter 'value' is required.
82              
83             =head1 EXAMPLE
84              
85             =for comment filename=create_and_print_value_string.pl
86              
87             use strict;
88             use warnings;
89              
90             use Wikibase::Datatype::Value::String;
91              
92             # Object.
93             my $obj = Wikibase::Datatype::Value::String->new(
94             'value' => 'foo',
95             );
96              
97             # Get type.
98             my $type = $obj->type;
99              
100             # Get value.
101             my $value = $obj->value;
102              
103             # Print out.
104             print "Type: $type\n";
105             print "Value: $value\n";
106              
107             # Output:
108             # Type: string
109             # Value: foo
110              
111             =head1 DEPENDENCIES
112              
113             L<Mo>,
114             L<Wikibase::Datatype::Value>.
115              
116             =head1 SEE ALSO
117              
118             =over
119              
120             =item L<Wikibase::Datatype::Value>
121              
122             Wikibase datatypes.
123              
124             =back
125              
126             =head1 REPOSITORY
127              
128             L<https://github.com/michal-josef-spacek/Wikibase-Datatype>
129              
130             =head1 AUTHOR
131              
132             Michal Josef Špaček L<mailto:skim@cpan.org>
133              
134             L<http://skim.cz>
135              
136             =head1 LICENSE AND COPYRIGHT
137              
138             © 2020-2023 Michal Josef Špaček
139              
140             BSD 2-Clause License
141              
142             =head1 VERSION
143              
144             0.31
145              
146             =cut