Data/Parser/RSS.pm

filter: Statementstmt 92.8% 26 / 28 Branchbran 25.0% 1 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 1 totaltotal 78.2% 36 / 46 CC 4 SCAR 11.0
CC
4
Cov
80%
get_value
6.5
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« Data/Parser/Atom.pm ↑ Summary Data/Parser/Meta.pm »
1 package Feed::Data::Parser::RSS;
2  
3 6 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 extends 'Feed::Data::Parser::Base';
5 6 ▶use XML::RSS::LibXML;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 6 ▶use Ref::Util ':all';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 6 ▶use Compiled::Params::OO qw/cpo/;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 6 ▶use Types::Standard qw/Object HashRef Str/;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 6 our $validate;
11 BEGIN {
12 6 ▶ $validate = cpo(
Subroutine BEGIN: called CC=1 SCAR=0.0
13 get_value => [Object, HashRef, Str],
14 );
15 }
16  
17 has '+parser' => (
18 default => sub {
19 6 ▶ my $self = shift;
Subroutine __ANON__: called CC=1 SCAR=0.0
20 6 return XML::RSS::LibXML->new->parse($self->content_ref);
21 },
22 6 );
23  
24 sub get_value {
25 132 ▶ my ($self, $item, $action) = $validate->get_value->(@_);
Subroutine get_value: called CC=4 SCAR=18.7
Pod undocumented
26
27 132 my $value = $item->{$action};
28  
29 132 ▶ if ( is_scalarref(\$value) || is_arrayref($value) ){
Branch: 2 branches
BranchTrueFalseTotal
if (is_scalarref(\$value) or is_arrayref($value)) { } 132 0 132
elsif (is_hashref($value)) { } 0 0 0
Condition33%1/3
is_scalarref(\$value) or is_arrayref($value)
l!l&&r!l&&!r
13200
MC/DC0%0/2
is_scalarref(\$value) or is_arrayref($value)
is_scalarref(\$value) is_arrayref($value)
Truth table33%1/3
A or B
A= is_scalarref(\$value)B= is_arrayref($value)
ABresult
1X1
011
000
30 132 return $value;
31 }
32 elsif ( is_hashref($value) ){
33 0 return $value->{encoded};
34 }
35
36 0 return '';
37 }
38  
39 6 1; # End of Feed::Data
« Data/Parser/Atom.pm ↑ Summary Data/Parser/Meta.pm »