SitemapIndex/XML/Sitemap.pm

filter: Statementstmt 100% 40 / 40 Branchbran 100% 2 / 2 Conditioncond 83.3% 5 / 6 MC/DCmcdc 75.0% 3 / 4 Subroutinesub 100% 9 / 9 Podpod 100% 1 / 1 totaltotal 96.7% 60 / 62 CC 5 SCAR 6.5
CC
5
Cov
98%
as_xml
3.0
__ANON__
3.0
BEGIN
1.0
CRAP 1.9
« Sitemap/XML/Types.pm ↑ Summary SitemapIndex/XML.pm »
1 #ABSTRACT: XML Sitemap index sitemap entry
2 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 8 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 package WWW::SitemapIndex::XML::Sitemap;
5 8 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
6 8 $WWW::SitemapIndex::XML::Sitemap::AUTHORITY = 'cpan:AJGB';
7 }
8 8 $WWW::SitemapIndex::XML::Sitemap::VERSION = '2.02';
9 8 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 8 ▶use WWW::Sitemap::XML::Types qw( Location );
Subroutine BEGIN: called CC=1 SCAR=0.0
11 8 ▶use MooseX::Types::DateTime::W3C qw( DateTimeW3C );
Subroutine BEGIN: called CC=1 SCAR=0.0
12 8 ▶use XML::LibXML;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14  
15  
16 8 has 'loc' => (
17 is => 'rw',
18 isa => Location,
19 required => 1,
20 coerce => 1,
21 predicate => 'has_loc',
22 );
23  
24  
25 8 has 'lastmod' => (
26 is => 'rw',
27 isa => DateTimeW3C,
28 required => 0,
29 coerce => 1,
30 predicate => 'has_lastmod',
31 );
32  
33  
34 78 ▶sub as_xml {
Subroutine as_xml: called CC=3 SCAR=11.0
Pod documented
35 78 my $self = shift;
36  
37 78 my $sitemap = XML::LibXML::Element->new('sitemap');
38  
39 do {
40 146 my $name = $_;
41 146 my $e = XML::LibXML::Element->new($name);
42  
43 146 $e->appendText( $self->$name );
44  
45 146 $sitemap->appendChild( $e );
46  
47 78 } for 'loc',grep {
48 78 ▶ eval('$self->has_'.$_) || defined $self->$_()
Condition66%2/3
eval '$self->has_' . $_ || defined $self->$_
l!l&&r!l&&!r
68010
MC/DC50%1/2
eval '$self->has_' . $_ || defined $self->$_
eval '$self->has_' . $_ defined $self->$_
Truth table66%2/3
A || B
A= eval '$self->has_' . $_B= defined $self->$_
ABresult
1X1
011
000
49 } qw( lastmod );
50  
51  
52 78 return $sitemap;
53 }
54  
55 87 ▶around BUILDARGS => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
56 87 my $next = shift;
57 87 my $class = shift;
58  
59 87 ▶ if ( @_ == 1 && ! ref $_[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1 and not ref $_[0]) 1 86 87
Condition100%3/3
@_ == 1 and not ref $_[0]
!ll&&!rl&&r
8421
MC/DC100%2/2
@_ == 1 and not ref $_[0]
@_ == 1 not ref $_[0]
Truth table100%3/3
A and not(B)
A= @_ == 1B= not ref $_[0]
ABresult
0X0
100
111
60 1 return $class->$next(loc => $_[0]);
61 }
62 86 return $class->$next( @_ );
63 8 };
64  
65 8 with 'WWW::SitemapIndex::XML::Sitemap::Interface';
66  
67  
68 8 __PACKAGE__->meta->make_immutable;
69  
70 8 1;
71  
72 __END__
« Sitemap/XML/Types.pm ↑ Summary SitemapIndex/XML.pm »