| 1 | package XML::Feed::Entry; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 39 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 35 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 35 | ▶ | use v5.10; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 35 | our $VERSION = '1.0.1'; | |||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 35 | ▶ | use base qw( Class::ErrorHandler ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 35 | ▶ | use Scalar::Util qw( blessed ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 35 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 35 | ▶ | use XML::Feed (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 26 | ▶ | sub wrap { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
wrap: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 26 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 18 | 26 | my($item) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 19 | 26 | bless { entry => $item }, $class; | |||||||||||||||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 8 | ▶ | sub unwrap { $_[0]->{entry} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unwrap: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 10 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 10 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 26 | 10 | my($format) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 27 | 10 | ▶ | $format //= 'Atom'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$format //= "Atom"
MC/DC100%1/1
$format //= "Atom"
$format
Truth table100%2/2
A
A= $format
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | Carp::croak("Unsupported format $format: not a recognised feed format") | ||||||||||||||||||||||||||||||||||||||||||
| 29 | 10 | ▶ | unless $XML::Feed::formatters{$format}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 9 | my $format_class = 'XML::Feed::Format::' . $format; | |||||||||||||||||||||||||||||||||||||||||
| 31 | 9 | ▶ | eval "use $format_class"; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 9 | ▶ | Carp::croak("Unsupported format $format: $@") if $@; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 9 | my $entry = bless {}, join('::', __PACKAGE__, "Format", $format); | |||||||||||||||||||||||||||||||||||||||||
| 34 | 9 | ▶ | $entry->init_empty or return $class->error($entry->errstr); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 9 | $entry; | |||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | sub init_empty { 1 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_empty: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | 3 | ▶ | sub convert { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
convert: called CC=8 SCAR=20.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 3 | my $entry = shift; | |||||||||||||||||||||||||||||||||||||||||
| 42 | 3 | my($format) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 43 | 3 | my $new = __PACKAGE__->new($format); | |||||||||||||||||||||||||||||||||||||||||
| 44 | 3 | for my $field (qw( title link content summary author id issued modified lat long )) { | |||||||||||||||||||||||||||||||||||||||||
| 45 | 30 | my $val = $entry->$field(); | |||||||||||||||||||||||||||||||||||||||||
| 46 | 30 | ▶ | next unless defined $val; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 21 | ▶ | next if blessed $val && $val->isa('XML::Feed::Content') && ! defined $val->body; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
builtin::blessed($val) and $val->isa("XML::Feed::Content") and not defined $val->body
builtin::blessed($val) and $val->isa("XML::Feed::Content")
MC/DC100%3/3
builtin::blessed($val) and $val->isa("XML::Feed::Content") and not defined $val->body
builtin::blessed($val)
$val->isa("XML::Feed::Content")
not defined $val->body
Truth table100%4/4
A and B and not(C)
A= builtin::blessed($val)B= $val->isa("XML::Feed::Content")C= not defined $val->body
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 20 | $new->$field($val); | |||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||
| 50 | 3 | for my $field (qw( category )) { | |||||||||||||||||||||||||||||||||||||||||
| 51 | 3 | my @val = $entry->$field(); | |||||||||||||||||||||||||||||||||||||||||
| 52 | 3 | ▶ | next unless @val; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | 2 | $new->$field(@val); | |||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||
| 55 | 3 | $new; | |||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | sub title; | ||||||||||||||||||||||||||||||||||||||||||
| 59 | sub link; | ||||||||||||||||||||||||||||||||||||||||||
| 60 | sub content; | ||||||||||||||||||||||||||||||||||||||||||
| 61 | sub summary; | ||||||||||||||||||||||||||||||||||||||||||
| 62 | sub category; | ||||||||||||||||||||||||||||||||||||||||||
| 63 | sub author; | ||||||||||||||||||||||||||||||||||||||||||
| 64 | sub id; | ||||||||||||||||||||||||||||||||||||||||||
| 65 | sub issued; | ||||||||||||||||||||||||||||||||||||||||||
| 66 | sub modified; | ||||||||||||||||||||||||||||||||||||||||||
| 67 | sub lat; | ||||||||||||||||||||||||||||||||||||||||||
| 68 | sub long; | ||||||||||||||||||||||||||||||||||||||||||
| 69 | sub format; | ||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | sub tags { shift->category(@_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tags: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | sub enclosure; | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | 35 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 74 | __END__ | ||||||||||||||||||||||||||||||||||||||||||