line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Wikibase::Datatype::Print::Value::Monolingual; |
2
|
|
|
|
|
|
|
|
3
|
48
|
|
|
48
|
|
943935
|
use base qw(Exporter); |
|
48
|
|
|
|
|
136
|
|
|
48
|
|
|
|
|
4488
|
|
4
|
48
|
|
|
48
|
|
338
|
use strict; |
|
48
|
|
|
|
|
116
|
|
|
48
|
|
|
|
|
998
|
|
5
|
48
|
|
|
48
|
|
230
|
use warnings; |
|
48
|
|
|
|
|
153
|
|
|
48
|
|
|
|
|
1493
|
|
6
|
|
|
|
|
|
|
|
7
|
48
|
|
|
48
|
|
1184
|
use Error::Pure qw(err); |
|
48
|
|
|
|
|
23460
|
|
|
48
|
|
|
|
|
2002
|
|
8
|
48
|
|
|
48
|
|
415
|
use Readonly; |
|
48
|
|
|
|
|
142
|
|
|
48
|
|
|
|
|
8058
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Readonly::Array our @EXPORT_OK => qw(print); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = 0.13; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub print { |
15
|
46
|
|
|
46
|
1
|
3889
|
my ($obj, $opts_hr) = @_; |
16
|
|
|
|
|
|
|
|
17
|
46
|
100
|
|
|
|
185
|
if (! $obj->isa('Wikibase::Datatype::Value::Monolingual')) { |
18
|
1
|
|
|
|
|
7
|
err "Object isn't 'Wikibase::Datatype::Value::Monolingual'."; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
45
|
|
|
|
|
179
|
return $obj->value.' ('.$obj->language.')'; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
1; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
__END__ |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=pod |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=encoding utf8 |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 NAME |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Wikibase::Datatype::Print::Value::Monolingual - Wikibase monolingual value pretty print helpers. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 SYNOPSIS |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
use Wikibase::Datatype::Print::Value::Monolingual 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::Monolingual> |
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::Monolingual'. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 EXAMPLE |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=for comment filename=create_and_print_value_monolingual.pl |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
use strict; |
66
|
|
|
|
|
|
|
use warnings; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
use Wikibase::Datatype::Print::Value::Monolingual; |
69
|
|
|
|
|
|
|
use Wikibase::Datatype::Value::Monolingual; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# Object. |
72
|
|
|
|
|
|
|
my $obj = Wikibase::Datatype::Value::Monolingual->new( |
73
|
|
|
|
|
|
|
'language' => 'en', |
74
|
|
|
|
|
|
|
'value' => 'English text', |
75
|
|
|
|
|
|
|
); |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# Print. |
78
|
|
|
|
|
|
|
print Wikibase::Datatype::Print::Value::Monolingual::print($obj)."\n"; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# Output: |
81
|
|
|
|
|
|
|
# English text (en) |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
L<Error::Pure>, |
86
|
|
|
|
|
|
|
L<Exporter>, |
87
|
|
|
|
|
|
|
L<Readonly>. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 SEE ALSO |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=over |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=item L<Wikibase::Datatype::Value::Monolingual> |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Wikibase monolingual value datatype. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=back |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 REPOSITORY |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
L<https://github.com/michal-josef-spacek/Wikibase-Datatype-Print> |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 AUTHOR |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Michal Josef Špaček L<mailto:skim@cpan.org> |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
L<http://skim.cz> |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
© 2020-2023 Michal Josef Špaček |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
BSD 2-Clause License |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 VERSION |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
0.13 |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=cut |