line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Wikibase::Datatype::Print::Value::String; |
2
|
|
|
|
|
|
|
|
3
|
44
|
|
|
44
|
|
356332
|
use base qw(Exporter); |
|
44
|
|
|
|
|
137
|
|
|
44
|
|
|
|
|
3967
|
|
4
|
44
|
|
|
44
|
|
428
|
use strict; |
|
44
|
|
|
|
|
106
|
|
|
44
|
|
|
|
|
923
|
|
5
|
44
|
|
|
44
|
|
237
|
use warnings; |
|
44
|
|
|
|
|
102
|
|
|
44
|
|
|
|
|
1491
|
|
6
|
|
|
|
|
|
|
|
7
|
44
|
|
|
44
|
|
1187
|
use Error::Pure qw(err); |
|
44
|
|
|
|
|
23151
|
|
|
44
|
|
|
|
|
1725
|
|
8
|
44
|
|
|
44
|
|
395
|
use Readonly; |
|
44
|
|
|
|
|
154
|
|
|
44
|
|
|
|
|
6871
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Readonly::Array our @EXPORT_OK => qw(print); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = 0.13; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub print { |
15
|
19
|
|
|
19
|
1
|
1499
|
my ($obj, $opts_hr) = @_; |
16
|
|
|
|
|
|
|
|
17
|
19
|
100
|
|
|
|
101
|
if (! $obj->isa('Wikibase::Datatype::Value::String')) { |
18
|
1
|
|
|
|
|
5
|
err "Object isn't 'Wikibase::Datatype::Value::String'."; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
18
|
|
|
|
|
112
|
return $obj->value; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
1; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
__END__ |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=pod |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=encoding utf8 |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 NAME |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Wikibase::Datatype::Print::Value::String - Wikibase string value pretty print helpers. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 SYNOPSIS |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
use Wikibase::Datatype::Print::Value::String qw(print); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my $pretty_print_string = print($obj, $opts_hr); |
41
|
|
|
|
|
|
|
my @pretty_print_lines = print($obj, $opts_hr); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 SUBROUTINES |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 C<print> |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
my $pretty_print_string = print($obj, $opts_hr); |
48
|
|
|
|
|
|
|
my @pretty_print_lines = print($obj, $opts_hr); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Construct pretty print output for L<Wikibase::Datatype::Value::String> |
51
|
|
|
|
|
|
|
object. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Returns string in scalar context. |
54
|
|
|
|
|
|
|
Returns list of lines in array context. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 ERRORS |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
print(): |
59
|
|
|
|
|
|
|
Object isn't 'Wikibase::Datatype::Value::String'. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 EXAMPLE |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=for comment filename=create_and_print_value_string.pl |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
use strict; |
66
|
|
|
|
|
|
|
use warnings; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
use Wikibase::Datatype::Print::Value::String; |
69
|
|
|
|
|
|
|
use Wikibase::Datatype::Value::String; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# Object. |
72
|
|
|
|
|
|
|
my $obj = Wikibase::Datatype::Value::String->new( |
73
|
|
|
|
|
|
|
'value' => 'foo', |
74
|
|
|
|
|
|
|
); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# Print. |
77
|
|
|
|
|
|
|
print Wikibase::Datatype::Print::Value::String::print($obj)."\n"; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
# Output: |
80
|
|
|
|
|
|
|
# foo |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
L<Error::Pure>, |
85
|
|
|
|
|
|
|
L<Exporter>, |
86
|
|
|
|
|
|
|
L<Readonly>. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 SEE ALSO |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=over |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item L<Wikibase::Datatype::Value::String> |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Wikibase string value datatype. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=back |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 REPOSITORY |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
L<https://github.com/michal-josef-spacek/Wikibase-Datatype-Print> |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 AUTHOR |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Michal Josef Špaček L<mailto:skim@cpan.org> |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
L<http://skim.cz> |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
© 2020-2023 Michal Josef Špaček |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
BSD 2-Clause License |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 VERSION |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
0.13 |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |