| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Data::InfoBox::Item; |
|
2
|
|
|
|
|
|
|
|
|
3
|
28
|
|
|
28
|
|
597389
|
use strict; |
|
|
28
|
|
|
|
|
61
|
|
|
|
28
|
|
|
|
|
1125
|
|
|
4
|
28
|
|
|
28
|
|
154
|
use warnings; |
|
|
28
|
|
|
|
|
57
|
|
|
|
28
|
|
|
|
|
1975
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
28
|
|
|
28
|
|
2466
|
use Mo qw(build is); |
|
|
28
|
|
|
|
|
3222
|
|
|
|
28
|
|
|
|
|
200
|
|
|
7
|
28
|
|
|
28
|
|
22672
|
use Mo::utils 0.08 qw(check_isa check_required); |
|
|
28
|
|
|
|
|
135334
|
|
|
|
28
|
|
|
|
|
1930
|
|
|
8
|
28
|
|
|
28
|
|
8352
|
use Mo::utils::URI 0.02 qw(check_uri); |
|
|
28
|
|
|
|
|
1001880
|
|
|
|
28
|
|
|
|
|
4001
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = 0.07; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has icon => ( |
|
13
|
|
|
|
|
|
|
is => 'ro', |
|
14
|
|
|
|
|
|
|
); |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has text => ( |
|
17
|
|
|
|
|
|
|
is => 'ro', |
|
18
|
|
|
|
|
|
|
); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has uri => ( |
|
21
|
|
|
|
|
|
|
is => 'ro', |
|
22
|
|
|
|
|
|
|
); |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub BUILD { |
|
25
|
50
|
|
|
50
|
0
|
4269447
|
my $self = shift; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Check icon. |
|
28
|
50
|
|
|
|
|
229
|
check_isa($self, 'icon', 'Data::Icon'); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Check text. |
|
31
|
49
|
|
|
|
|
961
|
check_required($self, 'text'); |
|
32
|
48
|
|
|
|
|
340
|
check_isa($self, 'text', 'Data::Text::Simple'); |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# Check URI. |
|
35
|
47
|
|
|
|
|
1101
|
check_uri($self, 'uri'); |
|
36
|
|
|
|
|
|
|
|
|
37
|
47
|
|
|
|
|
10926
|
return; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=pod |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=encoding utf8 |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 NAME |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Data::InfoBox::Item - Data object for info box item. |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Data object for one common item in info box. Item could contains icon, text and |
|
55
|
|
|
|
|
|
|
URL. |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
use Data::InfoBox::Item; |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my $obj = Data::InfoBox::Item->new(%params); |
|
62
|
|
|
|
|
|
|
my $icon = $obj->icon; |
|
63
|
|
|
|
|
|
|
my $text = $obj->text; |
|
64
|
|
|
|
|
|
|
my $uri = $obj->uri; |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 METHODS |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head2 C<new> |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
my $obj = Data::InfoBox->new(%params); |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Constructor. |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=over 8 |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item * C<icon> |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Icon for item. |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
It's L<Data::Icon> object. |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
It's optional. |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item * C<text> |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Item text. Must me a L<Data::Text::Simple> object. |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
It's required. |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item * C<uri> |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
URI of item. |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
It's optional. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=back |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Returns instance of object. |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 C<icon> |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
my $icon = $obj->icon; |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Get icon. |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Returns L<Data::Icon> instance. |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head2 C<text> |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
my $text = $obj->text; |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Get text of item. |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Returns L<Data::Text::Simple> object. |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 C<uri> |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
my $uri = $obj->uri; |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Get URI of item. |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Returns string. |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 ERRORS |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
new(): |
|
127
|
|
|
|
|
|
|
From Mo::utils: |
|
128
|
|
|
|
|
|
|
Parameter 'icon' must be a 'Data::Icon' object. |
|
129
|
|
|
|
|
|
|
Value: %s |
|
130
|
|
|
|
|
|
|
Reference: %s |
|
131
|
|
|
|
|
|
|
Parameter 'text' is required. |
|
132
|
|
|
|
|
|
|
Parameter 'text' must be a 'Data::Text::Simple' object. |
|
133
|
|
|
|
|
|
|
Value: %s |
|
134
|
|
|
|
|
|
|
Reference: %s |
|
135
|
|
|
|
|
|
|
From Mo::utils::URI::check_uri(): |
|
136
|
|
|
|
|
|
|
Parameter 'uri' doesn't contain valid URI. |
|
137
|
|
|
|
|
|
|
Value: %s |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 EXAMPLE |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=for comment filename=create_infobox_item_object_and_print.pl |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
use strict; |
|
144
|
|
|
|
|
|
|
use warnings; |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
use Data::Icon; |
|
147
|
|
|
|
|
|
|
use Data::InfoBox::Item; |
|
148
|
|
|
|
|
|
|
use Data::Text::Simple; |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
my $obj = Data::InfoBox::Item->new( |
|
151
|
|
|
|
|
|
|
'icon' => Data::Icon->new( |
|
152
|
|
|
|
|
|
|
'url' => 'https://example.com/foo.png', |
|
153
|
|
|
|
|
|
|
), |
|
154
|
|
|
|
|
|
|
'text' => Data::Text::Simple->new( |
|
155
|
|
|
|
|
|
|
'text' => 'Funny item' |
|
156
|
|
|
|
|
|
|
), |
|
157
|
|
|
|
|
|
|
'uri' => 'https://skim.cz', |
|
158
|
|
|
|
|
|
|
); |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
# Print out. |
|
161
|
|
|
|
|
|
|
print "Icon URL: ".$obj->icon->url."\n"; |
|
162
|
|
|
|
|
|
|
print "Text: ".$obj->text->text."\n"; |
|
163
|
|
|
|
|
|
|
print "URI: ".$obj->uri."\n"; |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
# Output: |
|
166
|
|
|
|
|
|
|
# Icon URL: https://example.com/foo.png |
|
167
|
|
|
|
|
|
|
# Text: Funny item |
|
168
|
|
|
|
|
|
|
# URI: https://skim.cz |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
L<Mo>, |
|
173
|
|
|
|
|
|
|
L<Mo::utils>, |
|
174
|
|
|
|
|
|
|
L<Mo::utils::URI>. |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=over |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=item L<Data::InfoBox> |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
Data object for info box. |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=item L<Test::Shared::Fixture::Data::InfoBox::Street> |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
Street info box fixture. |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=back |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head1 REPOSITORY |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
L<https://github.com/michal-josef-spacek/Data-InfoBox> |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=head1 AUTHOR |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
Michal Josef Špaček L<mailto:skim@cpan.org> |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
L<http://skim.cz> |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
© 2024-2025 Michal Josef Špaček |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
BSD 2-Clause License |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=head1 VERSION |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
0.07 |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=cut |