| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Web::Sitemap::Url; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.902_3'; |
|
4
|
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
32
|
use strict; |
|
|
4
|
|
|
|
|
10
|
|
|
|
4
|
|
|
|
|
141
|
|
|
6
|
4
|
|
|
4
|
|
27
|
use warnings; |
|
|
4
|
|
|
|
|
7
|
|
|
|
4
|
|
|
|
|
95
|
|
|
7
|
4
|
|
|
4
|
|
20
|
use utf8; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
21
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
|
86
|
use Carp; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
2410
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new |
|
12
|
|
|
|
|
|
|
{ |
|
13
|
50044
|
|
|
50044
|
0
|
145527
|
my ($class, $data, %p) = @_; |
|
14
|
|
|
|
|
|
|
|
|
15
|
50044
|
|
|
|
|
88188
|
my %allowed_keys = map { $_ => 1 } qw( |
|
|
100088
|
|
|
|
|
196324
|
|
|
16
|
|
|
|
|
|
|
mobile loc_prefix |
|
17
|
|
|
|
|
|
|
); |
|
18
|
|
|
|
|
|
|
|
|
19
|
50044
|
|
|
|
|
110903
|
my @bad_keys = grep { !exists $allowed_keys{$_} } keys %p; |
|
|
100088
|
|
|
|
|
199830
|
|
|
20
|
50044
|
50
|
|
|
|
110612
|
croak "Unknown parameters: @bad_keys" if @bad_keys; |
|
21
|
|
|
|
|
|
|
|
|
22
|
50044
|
|
|
|
|
147000
|
my $self = { |
|
23
|
|
|
|
|
|
|
mobile => 0, |
|
24
|
|
|
|
|
|
|
loc_prefix => '', |
|
25
|
|
|
|
|
|
|
%p, # actual input values |
|
26
|
|
|
|
|
|
|
}; |
|
27
|
|
|
|
|
|
|
|
|
28
|
50044
|
100
|
|
|
|
99454
|
if (not ref $data) { |
|
|
|
50
|
|
|
|
|
|
|
29
|
50041
|
50
|
|
|
|
94326
|
croak 'Web::Sitemap::Url first argument must be defined' |
|
30
|
|
|
|
|
|
|
unless defined $data; |
|
31
|
50041
|
|
|
|
|
76511
|
$self->{loc} = $data; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
elsif (ref $data eq 'HASH') { |
|
34
|
3
|
50
|
|
|
|
10
|
unless (defined $data->{loc}) { |
|
35
|
0
|
|
|
|
|
0
|
croak 'Web::Sitemap::Url first argument hash must have `loc` key defined'; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
3
|
|
|
|
|
18
|
$self = {%$self, %$data}; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
else { |
|
40
|
0
|
|
|
|
|
0
|
croak 'Web::Sitemap::Url first argument must be a string or a hash reference'; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
50044
|
|
|
|
|
148668
|
return bless $self, $class; |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub to_xml_string |
|
47
|
|
|
|
|
|
|
{ |
|
48
|
50044
|
|
|
50044
|
0
|
82441
|
my ($self, %p) = @_; |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
return sprintf( |
|
51
|
|
|
|
|
|
|
"\n%s%s%s%s%s", |
|
52
|
|
|
|
|
|
|
$self->{loc_prefix}, |
|
53
|
|
|
|
|
|
|
$self->{loc}, |
|
54
|
|
|
|
|
|
|
$self->{changefreq} ? sprintf('%s', $self->{changefreq}) : '', |
|
55
|
50044
|
50
|
|
|
|
132108
|
$self->{mobile} ? '' : '', |
|
|
|
50
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
$self->_images_xml_string |
|
57
|
|
|
|
|
|
|
); |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub _images_xml_string |
|
61
|
|
|
|
|
|
|
{ |
|
62
|
50044
|
|
|
50044
|
|
79458
|
my ($self) = @_; |
|
63
|
|
|
|
|
|
|
|
|
64
|
50044
|
|
|
|
|
72823
|
my $result = ''; |
|
65
|
|
|
|
|
|
|
|
|
66
|
50044
|
100
|
|
|
|
94910
|
if (defined $self->{images}) { |
|
67
|
3
|
|
|
|
|
6
|
my $i = 1; |
|
68
|
3
|
|
|
|
|
5
|
for my $image (@{$self->{images}{loc_list}}) { |
|
|
3
|
|
|
|
|
7
|
|
|
69
|
8
|
100
|
|
|
|
20
|
my $loc = ref $image eq 'HASH' ? $image->{loc} : $image; |
|
70
|
|
|
|
|
|
|
|
|
71
|
8
|
|
|
|
|
12
|
my $caption = ''; |
|
72
|
8
|
100
|
66
|
|
|
34
|
if (ref $image eq 'HASH' and defined $image->{caption}) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
73
|
4
|
|
|
|
|
7
|
$caption = $image->{caption}; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
elsif (defined $self->{images}{caption_format_simple}) { |
|
76
|
2
|
|
|
|
|
7
|
$caption = $self->{images}{caption_format_simple} . " $i"; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
elsif (defined $self->{images}{caption_format}) { |
|
79
|
2
|
|
|
|
|
3
|
$caption = &{$self->{images}{caption_format}}($i); |
|
|
2
|
|
|
|
|
11
|
|
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
8
|
|
|
|
|
42
|
$result .= sprintf( |
|
83
|
|
|
|
|
|
|
"\n%s", |
|
84
|
|
|
|
|
|
|
$loc, $caption |
|
85
|
|
|
|
|
|
|
); |
|
86
|
|
|
|
|
|
|
|
|
87
|
8
|
|
|
|
|
18
|
$i++; |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
50044
|
|
|
|
|
192674
|
return $result; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
1; |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
__END__ |