| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 39 | 8 | XML::Atom::Content->mk_attr_accessors(qw(src)); | |||||||||||||||||||
| 40 | } | ||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | 8 | ▶ | unless (XML::Atom::Thing->can('alternate_link')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 47 | 0 | ▶ | my @links1 = grep { $_->rel && $_->rel ne 'alternate'} $atom->links; | ||||||||||||||||||
|
Condition0%0/3
$_->rel && $_->rel ne 'alternate'
MC/DC0%0/2
$_->rel && $_->rel ne 'alternate'
$_->rel
$_->rel ne 'alternate'
Truth table0%0/3
A && B
A= $_->relB= $_->rel ne 'alternate'
| |||||||||||||||||||||
| 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'
MC/DC100%2/2
!$_->rel || $_->rel eq 'alternate'
!$_->rel
$_->rel eq 'alternate'
Truth table100%3/3
not(A) || B
A= !$_->relB= $_->rel eq 'alternate'
| |||||||||||||||||||||
| 58 | } | ||||||||||||||||||||
| 59 | 3 | ▶ | wantarray ? @hrefs : $hrefs[0]; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 75 | 1 | ▶ | my @links1 = grep { ! $_->rel || $_->rel ne $rel } $atom->links; | ||||||||||||||||||
|
Condition33%1/3
!$_->rel || $_->rel ne $rel
MC/DC0%0/2
!$_->rel || $_->rel ne $rel
!$_->rel
$_->rel ne $rel
Truth table33%1/3
not(A) || B
A= !$_->relB= $_->rel ne $rel
| |||||||||||||||||||||
| 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
MC/DC100%2/2
$_->rel && $_->rel eq $rel
$_->rel
$_->rel eq $rel
Truth table100%3/3
A && B
A= $_->relB= $_->rel eq $rel
| |||||||||||||||||||||
| 86 | } | ||||||||||||||||||||
| 87 | 3 | ▶ | wantarray ? @hrefs : $hrefs[0]; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 88 | 80 | }; | |||||||||||||||||||
| 89 | } | ||||||||||||||||||||
| 90 | |||||||||||||||||||||
| 91 | 8 | 1; | |||||||||||||||||||
| 92 | __END__ | ||||||||||||||||||||