Sitemap/XML/Google/Image.pm

filter: Statementstmt 75.0% 30 / 40 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 87.5% 7 / 8 Podpod 100% 1 / 1 totaltotal 67.2% 41 / 61 CC 5 SCAR 14.6
CC
5
Cov
69%
as_xml
12.0
__ANON__
3.2
BEGIN
1.0
CRAP 4.3
« Sitemap/XML.pm ↑ Summary Sitemap/XML/Types.pm »
1 #ABSTRACT: XML Sitemap Google extension image entry
2 22 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 22 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 package WWW::Sitemap::XML::Google::Image;
5 22 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
6 22 $WWW::Sitemap::XML::Google::Image::AUTHORITY = 'cpan:AJGB';
7 }
8 22 $WWW::Sitemap::XML::Google::Image::VERSION = '2.02';
9 22 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 22 ▶use WWW::Sitemap::XML::Types qw( Location );
Subroutine BEGIN: called CC=1 SCAR=0.0
11 22 ▶use XML::LibXML;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13  
14  
15 22 has 'loc' => (
16 is => 'rw',
17 isa => Location,
18 required => 1,
19 coerce => 1,
20 predicate => 'has_loc',
21 );
22  
23  
24 22 has 'caption' => (
25 is => 'rw',
26 isa => 'Str',
27 required => 0,
28 predicate => 'has_caption',
29 );
30  
31  
32 22 has 'title' => (
33 is => 'rw',
34 isa => 'Str',
35 required => 0,
36 predicate => 'has_title',
37 );
38  
39  
40 22 has 'geo_location' => (
41 is => 'rw',
42 isa => 'Str',
43 required => 0,
44 predicate => 'has_geo_location',
45 );
46  
47  
48 22 has 'license' => (
49 is => 'rw',
50 isa => Location,
51 required => 0,
52 coerce => 1,
53 predicate => 'has_license',
54 );
55  
56  
57 0 ▶sub as_xml {
Subroutine as_xml: not called CC=3 SCAR=24.8
Pod documented
58 0 my $self = shift;
59  
60 0 my $image = XML::LibXML::Element->new('image:image');
61  
62 do {
63 0 my $name = $_;
64 0 my $e = XML::LibXML::Element->new("image:$name");
65  
66 0 $e->appendText( $self->$name );
67  
68 0 $image->appendChild( $e );
69  
70 0 } for 'loc',grep {
71 0 ▶ eval('$self->has_'.$_) || defined $self->$_()
Condition0%0/3
eval '$self->has_' . $_ || defined $self->$_
l!l&&r!l&&!r
000
MC/DC0%0/2
eval '$self->has_' . $_ || defined $self->$_
eval '$self->has_' . $_ defined $self->$_
Truth table0%0/3
A || B
A= eval '$self->has_' . $_B= defined $self->$_
ABresult
1X1
011
000
72 } qw( caption title license geo_location );
73  
74 0 return $image;
75 }
76  
77 8 ▶around BUILDARGS => sub {
Subroutine __ANON__: called CC=3 SCAR=11.8
78 8 my $next = shift;
79 8 my $class = shift;
80  
81 8 ▶ if ( @_ == 1 && ! ref $_[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1 and not ref $_[0]) 0 8 8
Condition66%2/3
@_ == 1 and not ref $_[0]
!ll&&!rl&&r
440
MC/DC0%0/2
@_ == 1 and not ref $_[0]
@_ == 1 not ref $_[0]
Truth table66%2/3
A and not(B)
A= @_ == 1B= not ref $_[0]
ABresult
0X0
100
111
82 0 return $class->$next(loc => $_[0]);
83 }
84 8 return $class->$next( @_ );
85 22 };
86  
87 22 with 'WWW::Sitemap::XML::Google::Image::Interface';
88  
89  
90 22 __PACKAGE__->meta->make_immutable;
91  
92 22 1;
93  
94 __END__
« Sitemap/XML.pm ↑ Summary Sitemap/XML/Types.pm »