| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#ABSTRACT: XML Sitemap Google extension image entry |
|
2
|
14
|
|
|
14
|
|
80
|
use strict; |
|
|
14
|
|
|
|
|
27
|
|
|
|
14
|
|
|
|
|
468
|
|
|
3
|
14
|
|
|
14
|
|
79
|
use warnings; |
|
|
14
|
|
|
|
|
29
|
|
|
|
14
|
|
|
|
|
755
|
|
|
4
|
|
|
|
|
|
|
package WWW::Sitemap::XML::Google::Image; |
|
5
|
|
|
|
|
|
|
BEGIN { |
|
6
|
14
|
|
|
14
|
|
436
|
$WWW::Sitemap::XML::Google::Image::AUTHORITY = 'cpan:AJGB'; |
|
7
|
|
|
|
|
|
|
} |
|
8
|
|
|
|
|
|
|
$WWW::Sitemap::XML::Google::Image::VERSION = '2.02'; |
|
9
|
14
|
|
|
14
|
|
75
|
use Moose; |
|
|
14
|
|
|
|
|
28
|
|
|
|
14
|
|
|
|
|
111
|
|
|
10
|
14
|
|
|
14
|
|
95329
|
use WWW::Sitemap::XML::Types qw( Location ); |
|
|
14
|
|
|
|
|
35
|
|
|
|
14
|
|
|
|
|
141
|
|
|
11
|
14
|
|
|
14
|
|
67132
|
use XML::LibXML; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has 'loc' => ( |
|
16
|
|
|
|
|
|
|
is => 'rw', |
|
17
|
|
|
|
|
|
|
isa => Location, |
|
18
|
|
|
|
|
|
|
required => 1, |
|
19
|
|
|
|
|
|
|
coerce => 1, |
|
20
|
|
|
|
|
|
|
predicate => 'has_loc', |
|
21
|
|
|
|
|
|
|
); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has 'caption' => ( |
|
25
|
|
|
|
|
|
|
is => 'rw', |
|
26
|
|
|
|
|
|
|
isa => 'Str', |
|
27
|
|
|
|
|
|
|
required => 0, |
|
28
|
|
|
|
|
|
|
predicate => 'has_caption', |
|
29
|
|
|
|
|
|
|
); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has 'title' => ( |
|
33
|
|
|
|
|
|
|
is => 'rw', |
|
34
|
|
|
|
|
|
|
isa => 'Str', |
|
35
|
|
|
|
|
|
|
required => 0, |
|
36
|
|
|
|
|
|
|
predicate => 'has_title', |
|
37
|
|
|
|
|
|
|
); |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
has 'geo_location' => ( |
|
41
|
|
|
|
|
|
|
is => 'rw', |
|
42
|
|
|
|
|
|
|
isa => 'Str', |
|
43
|
|
|
|
|
|
|
required => 0, |
|
44
|
|
|
|
|
|
|
predicate => 'has_geo_location', |
|
45
|
|
|
|
|
|
|
); |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
has 'license' => ( |
|
49
|
|
|
|
|
|
|
is => 'rw', |
|
50
|
|
|
|
|
|
|
isa => Location, |
|
51
|
|
|
|
|
|
|
required => 0, |
|
52
|
|
|
|
|
|
|
coerce => 1, |
|
53
|
|
|
|
|
|
|
predicate => 'has_license', |
|
54
|
|
|
|
|
|
|
); |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub as_xml { |
|
58
|
|
|
|
|
|
|
my $self = shift; |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
my $image = XML::LibXML::Element->new('image:image'); |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
do { |
|
63
|
|
|
|
|
|
|
my $name = $_; |
|
64
|
|
|
|
|
|
|
my $e = XML::LibXML::Element->new("image:$name"); |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
$e->appendText( $self->$name ); |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
$image->appendChild( $e ); |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
} for 'loc',grep { |
|
71
|
|
|
|
|
|
|
eval('$self->has_'.$_) || defined $self->$_() |
|
72
|
|
|
|
|
|
|
} qw( caption title license geo_location ); |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
return $image; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
around BUILDARGS => sub { |
|
78
|
|
|
|
|
|
|
my $next = shift; |
|
79
|
|
|
|
|
|
|
my $class = shift; |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
if ( @_ == 1 && ! ref $_[0] ) { |
|
82
|
|
|
|
|
|
|
return $class->$next(loc => $_[0]); |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
return $class->$next( @_ ); |
|
85
|
|
|
|
|
|
|
}; |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
with 'WWW::Sitemap::XML::Google::Image::Interface'; |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
1; |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
__END__ |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=pod |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=encoding UTF-8 |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 NAME |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
WWW::Sitemap::XML::Google::Image - XML Sitemap Google extension image entry |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 VERSION |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
version 2.02 |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
my $image = WWW::Sitemap::XML::Google::Image->new( |
|
111
|
|
|
|
|
|
|
{ |
|
112
|
|
|
|
|
|
|
loc => 'http://mywebsite.com/image1.jpg', |
|
113
|
|
|
|
|
|
|
caption => 'Caption 1', |
|
114
|
|
|
|
|
|
|
title => 'Title 1', |
|
115
|
|
|
|
|
|
|
license => 'http://www.mozilla.org/MPL/2.0/', |
|
116
|
|
|
|
|
|
|
geo_location => 'Town, Region', |
|
117
|
|
|
|
|
|
|
}, |
|
118
|
|
|
|
|
|
|
); |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
XML output: |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?> |
|
123
|
|
|
|
|
|
|
<image:image> |
|
124
|
|
|
|
|
|
|
<image:loc>http://mywebsite.com/image1.jpg</image:loc> |
|
125
|
|
|
|
|
|
|
<image:caption>Caption 1</image:caption> |
|
126
|
|
|
|
|
|
|
<image:title>Title 1</image:title> |
|
127
|
|
|
|
|
|
|
<image:license>http://www.mozilla.org/MPL/2.0/</image:license> |
|
128
|
|
|
|
|
|
|
<image:geo_location>Town, Region</image:geo_location> |
|
129
|
|
|
|
|
|
|
</image:image> |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
WWW::Sitemap::XML::Google::Image represents single image entry in sitemap file. |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Class implements L<WWW::Sitemap::XML::Google::Image::Interface>. |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head2 loc |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
The URL of the image. |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
isa: L<WWW::Sitemap::XML::Types/"Location"> |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Required. |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head2 caption |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
The caption of the image. |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
isa: C<Str> |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Optional. |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head2 title |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
The title of the image. |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
isa: C<Str> |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Optional. |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head2 geo_location |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
The geographic location of the image. |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
isa: C<Str> |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Optional. |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head2 license |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
A URL to the license of the image. |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
isa: L<WWW::Sitemap::XML::Types/"Location"> |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Optional. |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head1 METHODS |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head2 as_xml |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
Returns L<XML::LibXML::Element> object representing the C<E<lt>image:imageE<gt>> entry in the sitemap. |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
L<https://support.google.com/webmasters/answer/183668> |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=head1 AUTHOR |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
Alex J. G. BurzyÅski <ajgb@cpan.org> |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
This software is copyright (c) 2014 by Alex J. G. BurzyÅski <ajgb@cpan.org>. |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
198
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=cut |