File Coverage

lib/MP3/PodcastFetch/Feed/Item.pm
Criterion Covered Total %
statement 14 14 100.0
branch 1 2 50.0
condition n/a
subroutine 5 5 100.0
pod 0 1 0.0
total 20 22 90.9


line stmt bran cond sub pod time code
1             package MP3::PodcastFetch::Feed::Item;
2              
3 1     1   4 use strict;
  1         2  
  1         31  
4 1     1   6 use warnings;
  1         2  
  1         27  
5 1     1   5 use Class::Struct;
  1         2  
  1         5  
6 1     1   937 use Date::Parse 'str2time';
  1         17499  
  1         193  
7              
8             =head1 NAME
9              
10             MP3::PodcastFetch::Feed::Item -- Structure for recording Podcast episode information
11              
12             =head1 SYNOPSIS
13              
14             use MP3::PodcastFetch::Feed::Item
15             my $item = MP3::PodcastFetch::Feed::Item->new(title=>'my podcast',
16             description =>'my very own podcast'
17             );
18             my $title = $item->title;
19             my $description = $item->description;
20             my $url = $item->url;
21              
22             =head1 DESCRIPTION
23              
24             This is a utility class for MP3::PodcastFetch that defines accessors
25             for various attributes of a Podcast episode, including its title,
26             description, author and URL.
27              
28             =head2 Accessors
29              
30             The following accessors are defined. They can be used to get and/or
31             fetch the current value:
32              
33             title Episode title
34             description Episode description
35             url Podcast file's downloaded URL (sound file URL)
36             link Podcast episode's web page (HTML file URL)
37             guid Episode unique ID
38             pubDate Episode publication date (in original format)
39             author Episode author
40             duration Episode's duration
41             timestamp Episode's modification date, in seconds
42              
43             =cut
44              
45             struct (
46             title => '$',
47             description => '$',
48             guid => '$',
49             pubDate => '$',
50             author => '$',
51             link => '$',
52             url => '$',
53             duration => '$',
54             );
55              
56             sub timestamp {
57 24 50   24 0 3858 my $date = shift->pubDate or return 0;
58 24         195 str2time($date);
59             }
60              
61              
62             1;
63              
64              
65             __END__