line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#ABSTRACT: XML Sitemap index sitemap entry |
2
|
6
|
|
|
6
|
|
36852
|
use strict; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
202
|
|
3
|
6
|
|
|
6
|
|
34
|
use warnings; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
309
|
|
4
|
|
|
|
|
|
|
package WWW::SitemapIndex::XML::Sitemap; |
5
|
|
|
|
|
|
|
BEGIN { |
6
|
6
|
|
|
6
|
|
167
|
$WWW::SitemapIndex::XML::Sitemap::AUTHORITY = 'cpan:AJGB'; |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
$WWW::SitemapIndex::XML::Sitemap::VERSION = '2.02'; |
9
|
6
|
|
|
6
|
|
835
|
use Moose; |
|
6
|
|
|
|
|
492073
|
|
|
6
|
|
|
|
|
37
|
|
10
|
6
|
|
|
6
|
|
43926
|
use WWW::Sitemap::XML::Types qw( Location ); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use MooseX::Types::DateTime::W3C qw( DateTimeW3C ); |
12
|
|
|
|
|
|
|
use XML::LibXML; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has 'loc' => ( |
17
|
|
|
|
|
|
|
is => 'rw', |
18
|
|
|
|
|
|
|
isa => Location, |
19
|
|
|
|
|
|
|
required => 1, |
20
|
|
|
|
|
|
|
coerce => 1, |
21
|
|
|
|
|
|
|
predicate => 'has_loc', |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has 'lastmod' => ( |
26
|
|
|
|
|
|
|
is => 'rw', |
27
|
|
|
|
|
|
|
isa => DateTimeW3C, |
28
|
|
|
|
|
|
|
required => 0, |
29
|
|
|
|
|
|
|
coerce => 1, |
30
|
|
|
|
|
|
|
predicate => 'has_lastmod', |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub as_xml { |
35
|
|
|
|
|
|
|
my $self = shift; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my $sitemap = XML::LibXML::Element->new('sitemap'); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
do { |
40
|
|
|
|
|
|
|
my $name = $_; |
41
|
|
|
|
|
|
|
my $e = XML::LibXML::Element->new($name); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
$e->appendText( $self->$name ); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
$sitemap->appendChild( $e ); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
} for 'loc',grep { |
48
|
|
|
|
|
|
|
eval('$self->has_'.$_) || defined $self->$_() |
49
|
|
|
|
|
|
|
} qw( lastmod ); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
return $sitemap; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
around BUILDARGS => sub { |
56
|
|
|
|
|
|
|
my $next = shift; |
57
|
|
|
|
|
|
|
my $class = shift; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
if ( @_ == 1 && ! ref $_[0] ) { |
60
|
|
|
|
|
|
|
return $class->$next(loc => $_[0]); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
return $class->$next( @_ ); |
63
|
|
|
|
|
|
|
}; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
with 'WWW::SitemapIndex::XML::Sitemap::Interface'; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
__END__ |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=pod |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=encoding UTF-8 |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 NAME |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
WWW::SitemapIndex::XML::Sitemap - XML Sitemap index sitemap entry |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 VERSION |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
version 2.02 |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 SYNOPSIS |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
my $sitemap = WWW::SitemapIndex::XML::Sitemap->new( |
89
|
|
|
|
|
|
|
loc => 'http://mywebsite.com/sitemap1.xml.gz', |
90
|
|
|
|
|
|
|
lastmod => '2010-11-26', |
91
|
|
|
|
|
|
|
); |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
XML output: |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?> |
96
|
|
|
|
|
|
|
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> |
97
|
|
|
|
|
|
|
<sitemap> |
98
|
|
|
|
|
|
|
<loc>http://mywebsite.com/sitemap1.xml.gz</loc> |
99
|
|
|
|
|
|
|
<lastmod>2010-11-26</lastmod> |
100
|
|
|
|
|
|
|
</sitemap> |
101
|
|
|
|
|
|
|
</sitemapindex> |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 DESCRIPTION |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
WWW::SitemapIndex::XML::Sitemap represents single sitemap entry in sitemaps index file. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Class implements L<WWW::SitemapIndex::XML::Sitemap::Interface>. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head2 loc |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
URL of the sitemap. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
isa: L<WWW::Sitemap::XML::Types/"Location"> |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Required. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head2 lastmod |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
The date of last modification of the sitemap. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
isa: L<MooseX::Types::DateTime::W3C/"DateTimeW3C"> |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Optional. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 METHODS |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head2 as_xml |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Returns L<XML::LibXML::Element> object representing the C<E<lt>sitemapE<gt>> |
132
|
|
|
|
|
|
|
entry in the sitemaps index. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 SEE ALSO |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
L<http://www.sitemaps.org/protocol.php> |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 AUTHOR |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Alex J. G. BurzyÅski <ajgb@cpan.org> |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
This software is copyright (c) 2014 by Alex J. G. BurzyÅski <ajgb@cpan.org>. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
147
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=cut |