| 1 | package Mojo::Feed; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 13 | ▶ | use Mojo::Base '-base'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 13 | ▶ | use Mojo::DOM; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 13 | ▶ | use Mojo::File; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 13 | ▶ | use Mojo::URL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 13 | ▶ | use Mojo::UserAgent; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 13 | ▶ | use Mojo::Util qw(decode trim); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 13 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 13 | ▶ | use List::Util; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 13 | ▶ | use HTTP::Date qw(str2time); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 13 | ▶ | use Mojo::Feed::Item; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | use overload | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 47 | ▶ | bool => sub { shift->is_valid }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 15 | ▶ | '""' => sub { shift->to_string }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 13 | fallback => 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 13 | our $VERSION = "0.22"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 13 | has charset => 'UTF-8'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 4 | ▶ | has ua => sub { Mojo::UserAgent->new() }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 9 | ▶ | has max_redirects => sub { $ENV{MOJO_MAX_REDIRECTS} || 3 }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 17 | ▶ | has redirects => sub { [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 2 | ▶ | has related => sub { [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 52 | ▶ | has url => sub { Mojo::URL->new() }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 2 | ▶ | has file => sub { Mojo::File->new() }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 9 | ▶ | has source => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 9 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 9 | ▶ | ($self->url ne '') ? $self->url | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | : (-f $self->file) ? $self->file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 13 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 100 | ▶ | has body => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 100 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 100 | ▶ | if ($self->url ne '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 50 | return $self->_load(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | else { # skip file tests, just slurp (for Mojo::Asset::File) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 50 | return $self->file->slurp(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 13 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 139 | ▶ | has text => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 139 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 139 | ▶ | return decode($self->charset, $self->body) || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
decode($self->charset, $self->body) || ''
MC/DC100%1/1
decode($self->charset, $self->body) || ''
decode($self->charset, $self->body)
Truth table100%2/2
A
A= decode($self->charset, $self->body)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 13 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 139 | ▶ | has dom => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 139 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 139 | return Mojo::DOM->new->xml(1)->parse($self->text); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 13 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | # The top node, not the root | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 85 | ▶ | has top => sub { shift->dom->children->first }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 6 | ▶ | has feed_type => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 6 | my $top = shift->top; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 6 | my $tag = $top->tag; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 6 | my $version = $top->attr('version'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 6 | my $ns = $top->namespace; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 6 | ▶ | ($tag =~ /feed/i) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | ? ($version) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | ? 'Atom ' . $version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | : 'Atom 1.0' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | : ($tag =~ /rss/i) ? 'RSS ' . $version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | : ($tag =~ /rdf/i) ? 'RSS 1.0' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | : 'unknown'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 13 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 81 | ▶ | has namespaces => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 81 | my $top = shift->top; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 81 | my $namespaces = { atom => $top->namespace }; # only Atom feeds declare a namespace? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 81 | my $attrs = $top->attr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 81 | for my $at (keys %$attrs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 279 | ▶ | if ($at =~ /xmlns\:(\w+)/) { # extra namespace declaration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 120 | $namespaces->{$1} = $attrs->{$at}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 81 | return $namespaces; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 13 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 13 | my %generic = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | description => ['description', 'tagline', 'subtitle'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | published => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 'published', 'pubDate', 'dc|date', 'created', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 'issued', 'updated', 'modified' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | author => ['author', 'dc|creator', 'webMaster', 'copyright'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | title => ['title'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | subtitle => ['subtitle', 'tagline'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | link => ['link:not([rel])', 'link[rel=alternate]'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 334 | ▶ | sub _get_selector { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_selector: called CC=9 SCAR=22.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 334 | my ($self, $k) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 334 | for my $generic (@{$generic{$k}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 707 | ▶ | if (my $p = $self->dom->at("channel > $generic, feed > $generic", %{$self->namespaces})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 285 | ▶ | if ($k eq 'author' && $p->at('name')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$k eq "author" and $p->at("name")
MC/DC100%2/2
$k eq "author" and $p->at("name")
$k eq "author"
$p->at("name")
Truth table100%3/3
A and B
A= $k eq "author"B= $p->at("name")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 22 | return trim $p->at('name')->text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 263 | ▶ | my $text = trim($p->text || $p->content || $p->attr('href') || ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition87%7/8
$p->text || $p->content || $p->attr('href') || ''
$p->text or $p->content or $p->attr("href")
$p->text or $p->content
MC/DC66%2/3
$p->text || $p->content || $p->attr('href') || ''
$p->text
$p->content
$p->attr("href")
Truth table75%3/4
A or B or C
A= $p->textB= $p->contentC= $p->attr("href")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 263 | ▶ | if ($k eq 'published') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 47 | return str2time($text); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 216 | return $text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 2 | ▶ | sub _set_selector { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_set_selector: called CC=6 SCAR=20.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 2 | my ($self, $k, $val) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 2 | for my $generic (@{$generic{$k}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 2 | ▶ | if (my $p = $self->dom->at("channel > $generic, feed > $generic", %{$self->namespaces})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 2 | ▶ | if ($k eq 'author' && $p->at('name')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$k eq "author" and $p->at("name")
MC/DC0%0/2
$k eq "author" and $p->at("name")
$k eq "author"
$p->at("name")
Truth table33%1/3
A and B
A= $k eq "author"B= $p->at("name")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | return $p->at('name')->content($val); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 2 | ▶ | if ($k eq 'published') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | return $p->content(Mojo::Date->new($val)->to_datetime()); # let's pretend we're all OK with Atom dates | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 2 | return $p->content($val); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 13 | foreach my $k (keys %generic) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 254 | ▶ | has $k => sub { return shift->_get_selector($k) || undef; }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Condition100%2/2
(shift())->_get_selector($k) || undef
MC/DC100%1/1
(shift())->_get_selector($k) || undef
(shift())->_get_selector($k)
Truth table100%2/2
A
A= (shift())->_get_selector($k)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 69 | ▶ | has items => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 69 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | $self->dom->find('item, entry') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 69 | ▶ | ->map(sub { Mojo::Feed::Item->new(dom => $_, feed => $self) }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 13 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | # alias | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | sub entries { shift->items() }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
entries: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | # change the underlying DOM when we change the items list: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 1 | ▶ | sub set_items { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_items: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 1 | my ($self, $new_items) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 1 | ▶ | $self->dom->find('item, entry')->each(sub { $_->remove() }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 1 | ▶ | $new_items->each(sub { $self->top->append($_->dom) }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 1 | return $self->items($new_items); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 108 | ▶ | has is_valid => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 108 | my $top = shift->dom->children->first; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 92 | ▶ | return defined $top && $top->tag =~ /^(feed|rss|rdf|rdf:rdf)$/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
defined $top && $top->tag =~ /^(feed|rss|rdf|rdf:rdf)$/iu
MC/DC100%2/2
defined $top && $top->tag =~ /^(feed|rss|rdf|rdf:rdf)$/iu
defined $top
$top->tag =~ /^(feed|rss|rdf|rdf:rdf)$/iu
Truth table100%3/3
A && B
A= defined $topB= $top->tag =~ /^(feed|rss|rdf|rdf:rdf)$/iu
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 13 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 121 | ▶ | sub is_feed_content_type { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_feed_content_type: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 121 | my ($self, $content_type) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 121 | ▶ | return undef unless defined $content_type && length $content_type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $content_type and length $content_type
MC/DC50%1/2
defined $content_type and length $content_type
defined $content_type
length $content_type
Truth table66%2/3
A and B
A= defined $content_typeB= length $content_type
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | # use split to remove charset attribute from content_type header | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 120 | ($content_type) = split(/[; ]+/, $content_type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | # feed mime-types: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 120 | my @feed_types = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 'application/x.atom+xml', 'application/atom+xml', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 'application/xml', 'text/xml', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 'application/rss+xml', 'application/rdf+xml' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 120 | ▶ | return List::Util::first { $_ eq $content_type } @feed_types; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 72 | ▶ | sub _load { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_load: called CC=15 SCAR=27.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 72 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 72 | my $tx = $self->ua->get($self->url); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 72 | ▶ | if (my $error = $tx->error) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 5 | ▶ | unless ($tx->res->code) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 5 | $self->is_valid(undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | croak "Error getting feed from url ", $self->url, ": ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 5 | $error->{message}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 67 | my $result = $tx->result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 67 | ▶ | if ($result->is_error) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 8 | $self->is_valid(undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 8 | ▶ | croak "Error getting feed from url ", $self->url, ": ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$result->message // ""
MC/DC0%0/1
$result->message // ""
$result->message
Truth table50%1/2
A
A= $result->message
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | $result->code, " ", ($result->message // ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | # Redirect: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | elsif ($result->code =~ /^(301|302|303|307|308)$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 20 | my $new_url = Mojo::URL->new($result->headers->location) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | ->to_abs($tx->req->url); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 20 | push @{$self->redirects}, $self->url; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 20 | $self->url($new_url); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 20 | ▶ | if (@{$self->redirects} > $self->max_redirects) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 3 | $self->is_valid(undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 3 | croak "Number of redirects exceeded when loading feed" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 17 | return $self->_load(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | # Is this a feed (by content type)? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 39 | ▶ | if ($self->is_feed_content_type($result->headers->content_type)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 25 | ▶ | $self->charset($result->content->charset) if ($result->content->charset); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 25 | return $result->body; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | # we are in a web page. PHEAR. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | # Set real (absolute) URL (is this only relevant for testing?): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 14 | ▶ | if ($self->url ne $tx->req->url) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 5 | push @{$self->redirects}, $self->url; # for logging? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 5 | $self->url($tx->req->url); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 14 | my @feeds = $self->find_feed_links($result); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 14 | ▶ | if (@feeds) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 5 | push @{$self->redirects}, $self->url; # not really a redirect, but save it | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 5 | $self->url(shift @feeds); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | # save any remaining feed links as related | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 5 | ▶ | push @{$self->related}, @feeds if (@feeds); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 5 | return $self->_load(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | # call me crazy, but maybe this is just a feed served as HTML? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 9 | my $test = Mojo::Feed->new( url => $self->url, body => $result->body ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 9 | ▶ | $test->charset($result->content->charset) if ($result->content->charset); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 9 | ▶ | if ($test->is_valid) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | # can't avoid parsing twice; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | # body is probably being called in the dom initializer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | # :( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | # $self->dom($test->dom); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 6 | ▶ | $self->charset($test->charset) if ($test->charset); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 6 | return $test->body; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 3 | $self->is_valid(undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 3 | croak "No valid feed found at ", $self->url; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 35 | ▶ | sub find_feed_links { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_feed_links: called CC=3 SCAR=11.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 35 | my ($self, $result) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 35 | my @feeds; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | # Find feed link elements in HEAD: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 35 | ▶ | my $base | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$result->dom->find('head base')->map('attr', 'href')->join('') || $self->url
MC/DC0%0/2
$result->dom->find('head base')->map('attr', 'href')->join('') || $self->url
$result->dom->find('head base')->map('attr', 'href')->join('')
$self->url
Truth table33%1/3
A || B
A= $result->dom->find('head base')->map('attr', 'href')->join('')B= $self->url
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | = Mojo::URL->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | $result->dom->find('head base')->map('attr', 'href')->join('') || $self->url) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | ->to_abs($self->url); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 35 | ▶ | my $title | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$result->dom->find('head > title')->map('text')->join('') || $self->url
MC/DC0%0/2
$result->dom->find('head > title')->map('text')->join('') || $self->url
$result->dom->find('head > title')->map('text')->join('')
$self->url
Truth table33%1/3
A || B
A= $result->dom->find('head > title')->map('text')->join('')B= $self->url
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | = $result->dom->find('head > title')->map('text')->join('') || $self->url; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 338 | ▶ | $result->dom->find('head link')->each(sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=19.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 338 | my $attrs = $_->attr(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 338 | ▶ | return unless ($attrs->{'rel'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 332 | my %rel = map { $_ => 1 } split /\s+/, lc($attrs->{'rel'}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 332 | ▶ | my $type = ($attrs->{'type'}) ? lc trim $attrs->{'type'} : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 332 | ▶ | if ($type && $self->is_feed_content_type($type) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%6/9
$type and $self->is_feed_content_type($type) and $rel{"alternate"} || $rel{"service.feed"}
$type and $self->is_feed_content_type($type)
$rel{"alternate"} or $rel{"service.feed"}
MC/DC50%2/4
$type and $self->is_feed_content_type($type) and $rel{"alternate"} || $rel{"service.feed"}
$type
$self->is_feed_content_type($type)
$rel{"alternate"}
$rel{"service.feed"}
Truth table60%3/5
A and B and C or D
A= $typeB= $self->is_feed_content_type($type)C= $rel{"alternate"}D= $rel{"service.feed"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | && ($rel{'alternate'} || $rel{'service.feed'})) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 21 | push @feeds, Mojo::URL->new($attrs->{'href'})->to_abs($base); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 35 | }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | # Find feed links (<A HREF="...something feed-like">) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 35 | state $feed_exp = qr/((\.(?:rss|xml|rdf)$)|(\/feed\/*$)|(feeds*\.))/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 854 | ▶ | $result->dom->find('a')->grep(sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 854 | ▶ | $_->attr('href') && $_->attr('href') =~ /$feed_exp/io; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 8 | ▶ | })->each(sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 8 | push @feeds, Mojo::URL->new($_->attr('href'))->to_abs($base); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 35 | }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 35 | return @feeds; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 28 | ▶ | sub to_hash { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to_hash: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 28 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 28 | ▶ | my $hash = {map { $_ => '' . ($self->$_ || '') } (keys %generic)}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->$_ || ''
MC/DC100%1/1
$self->$_ || ''
$self->$_
Truth table100%2/2
A
A= $self->$_
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 28 | $hash->{items} = $self->items->map('to_hash')->to_array; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 28 | return $hash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 15 | ▶ | sub to_string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to_string: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 15 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 15 | foreach my $k (keys %generic) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 90 | ▶ | if ($self->$k && $self->$k ne $self->_get_selector($k)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->$k and $self->$k ne $self->_get_selector($k)
MC/DC100%2/2
$self->$k and $self->$k ne $self->_get_selector($k)
$self->$k
$self->$k ne $self->_get_selector($k)
Truth table100%3/3
A and B
A= $self->$kB= $self->$k ne $self->_get_selector($k)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | # write it to the DOM: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 2 | $self->_set_selector($k, $self->$k); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 15 | ▶ | $self->items->each(sub { $_->to_string }); # maybe break this out to a sync method | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 15 | $self->dom->to_string; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 13 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||