Atompub.pm

filter: Statementstmt 98.7% 76 / 77 Branchbran 65.0% 13 / 20 Conditioncond 58.3% 7 / 12 MC/DCmcdc 50.0% 4 / 8 Subroutinesub 100% 12 / 12 Podpod n/a totaltotal 86.8% 112 / 129 CC 10 SCAR 11.2
CC
10
Cov
88%
__ANON__
5.2
__ANON__
5.0
__ANON__
2.0
CRAP 3.1
« Collection.pm ↑ Summary Workspace.pm »
1 package XML::Atom::Atompub;
2  
3 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 8 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 8 ▶use XML::Atom::Entry;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 8 ▶use XML::Atom::Service;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 8 ▶use XML::Atom::Thing;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 8 ▶unless (XML::Atom::Entry->can('edited')) {
Branch: 1 branch
BranchTrueFalseTotal
unless ("XML::Atom::Entry"->can("edited")) 8 0 8
11 3 ▶ *XML::Atom::Entry::edited = sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
12 3 my($self, $edited) = @_;
13 3 my $ns_uri = $XML::Atom::Service::DefaultNamespace;
14 3 my $app = XML::Atom::Namespace->new(app => $ns_uri);
15 3 ▶ if ($edited) {
Branch: 1 branch
BranchTrueFalseTotal
if ($edited) { } 1 2 3
16 1 $self->set($app, 'edited', $edited);
17 }
18 else {
19 2 $self->get($app, 'edited');
20 }
21 8 };
22 }
23  
24 8 ▶unless (XML::Atom::Entry->can('control')) {
Branch: 1 branch
BranchTrueFalseTotal
unless ("XML::Atom::Entry"->can("control")) 8 0 8
25 8 XML::Atom::Entry->mk_object_list_accessor('control' => 'XML::Atom::Control');
26  
27 package XML::Atom::Control;
28  
29 8 ▶ use base qw(XML::Atom::Base);
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 8 __PACKAGE__->mk_elem_accessors(qw(draft));
32  
33 1 ▶ sub element_name { 'control' }
Subroutine element_name: called CC=1 SCAR=0.0
34  
35 4 ▶ sub element_ns { $XML::Atom::Service::DefaultNamespace }
Subroutine element_ns: called CC=1 SCAR=0.0
36 }
37  
38 8 ▶unless (XML::Atom::Content->can('src')) {
Branch: 1 branch
BranchTrueFalseTotal
unless ("XML::Atom::Content"->can("src")) 8 0 8
39 8 XML::Atom::Content->mk_attr_accessors(qw(src));
40 }
41  
42 8 ▶unless (XML::Atom::Thing->can('alternate_link')) {
Branch: 1 branch
BranchTrueFalseTotal
unless ("XML::Atom::Thing"->can("alternate_link")) 8 0 8
43 3 ▶ *XML::Atom::Thing::alternate_link = sub {
Subroutine __ANON__: called CC=5 SCAR=16.4
44 3 my($atom, @args) = @_;
45 3 my @hrefs;
46 3 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) { } 1 2 3
47 0 ▶ my @links1 = grep { $_->rel && $_->rel ne 'alternate'} $atom->links;
Condition0%0/3
$_->rel && $_->rel ne 'alternate'
!ll&&!rl&&r
000
MC/DC0%0/2
$_->rel && $_->rel ne 'alternate'
$_->rel $_->rel ne 'alternate'
Truth table0%0/3
A && B
A= $_->relB= $_->rel ne 'alternate'
ABresult
0X0
100
111
48 1 my @links2 = map { my $link = XML::Atom::Link->new;
49 1 $link->rel('alternate');
50 1 $link->href($_);
51 1 $link }
52 @args;
53 1 $atom->link( @links1, @links2 );
54 1 @hrefs = @_;
55 }
56 else {
57 2 ▶ @hrefs = map { $_->href } grep { ! $_->rel || $_->rel eq 'alternate' } $atom->links;
Condition100%3/3
!$_->rel || $_->rel eq 'alternate'
l!l&&r!l&&!r
112
MC/DC100%2/2
!$_->rel || $_->rel eq 'alternate'
!$_->rel $_->rel eq 'alternate'
Truth table100%3/3
not(A) || B
A= !$_->relB= $_->rel eq 'alternate'
ABresult
1X1
011
000
58 }
59 3 ▶ wantarray ? @hrefs : $hrefs[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 3 3
60 8 };
61 }
62  
63 8 for my $rel (qw(self edit edit-media related enclosure via first previous next last)) {
64 8 ▶ no strict 'refs'; ## no critic
Subroutine BEGIN: called CC=1 SCAR=0.0
65  
66 80 my $method = join '_', $rel, 'link';
67 80 $method =~ s/-/_/g;
68  
69 80 ▶ next if XML::Atom::Thing->can($method);
Branch: 1 branch
BranchTrueFalseTotal
if "XML::Atom::Thing"->can($method) 0 80 80
70  
71 80 ▶ *{"XML::Atom::Thing::$method"} = sub {
Subroutine __ANON__: called CC=5 SCAR=16.2
72 3 my($atom, @args) = @_;
73 3 my @hrefs;
74 3 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) { } 1 2 3
75 1 ▶ my @links1 = grep { ! $_->rel || $_->rel ne $rel } $atom->links;
Condition33%1/3
!$_->rel || $_->rel ne $rel
l!l&&r!l&&!r
010
MC/DC0%0/2
!$_->rel || $_->rel ne $rel
!$_->rel $_->rel ne $rel
Truth table33%1/3
not(A) || B
A= !$_->relB= $_->rel ne $rel
ABresult
1X1
011
000
76 1 my @links2 = map { my $link = XML::Atom::Link->new;
77 1 $link->rel( $rel );
78 1 $link->href($_);
79 1 $link }
80 @args;
81 1 $atom->link( @links1, @links2 );
82 1 @hrefs = @_;
83 }
84 else {
85 2 ▶ @hrefs = map { $_->href } grep { $_->rel && $_->rel eq $rel } $atom->links;
Condition100%3/3
$_->rel && $_->rel eq $rel
!ll&&!rl&&r
112
MC/DC100%2/2
$_->rel && $_->rel eq $rel
$_->rel $_->rel eq $rel
Truth table100%3/3
A && B
A= $_->relB= $_->rel eq $rel
ABresult
0X0
100
111
86 }
87 3 ▶ wantarray ? @hrefs : $hrefs[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 3 3
88 80 };
89 }
90  
91 8 1;
92 __END__
« Collection.pm ↑ Summary Workspace.pm »