File Coverage

blib/lib/XML/Atom/Ext/Media.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package XML::Atom::Ext::Media;
2             our $VERSION = '0.092840';
3              
4              
5             # ABSTRACT: An XML::Atom extenstion for the yahoo Media RSS extension
6              
7 1     1   33045 use strict;
  1         2  
  1         36  
8 1     1   5 use warnings;
  1         2  
  1         37  
9              
10 1     1   5 use base qw( XML::Atom::Base );
  1         14  
  1         913  
11              
12             use XML::Atom::Feed;
13              
14             use XML::Atom::Ext::Media::Group;
15             use XML::Atom::Ext::Media::Content;
16             use XML::Atom::Ext::Media::Thumbnail;
17              
18              
19              
20             BEGIN {
21             XML::Atom::Entry->mk_object_list_accessor(
22             group => 'XML::Atom::Ext::Media::Group',
23             'media_groups',
24             );
25             # XXX: This conflicts with , how to restrict to NS?
26             # XML::Atom::Entry->mk_object_list_accessor(
27             # content => 'XML::Atom::Ext::Media::Content'
28             # );
29             }
30              
31              
32             sub element_ns {
33             return XML::Atom::Namespace->new(
34             "media" => q{http://search.yahoo.com/mrss/}
35             );
36             }
37              
38             1;
39              
40              
41              
42              
43             =pod
44              
45             =head1 NAME
46              
47             XML::Atom::Ext::Media - An XML::Atom extenstion for the yahoo Media RSS extension
48              
49             =head1 VERSION
50              
51             version 0.092840
52              
53             =head1 DESCRIPTION
54              
55             A for the moment rather crude and simple module for handeling MRSS elements
56              
57             =head1 SYNOPSIS
58              
59             use XML::Atom::Feed;
60             use XML::Atom::Ext::Media;
61              
62             my $feed = XML::Atom::Feed->new(
63             URI->new('http://gdata.youtube.com/feeds/api/users/andreasmarienborg/uploads')
64             );
65              
66             my ($entry) = $feed->entries;
67             my ($media) = $entry->media_groups;
68             my $content = $media->default_content;
69             my $thumb_url = $media->thumbnail->url;
70              
71             =head1 IMPLEMENTATION
72              
73             The L we describe here end up on L-objects, except
74             for L.
75              
76             =head1 ACKNOWLEDGEMENTS
77              
78             Thank you to L for being invaluable aid in figuring out
79             how to write extension for L. Thank you to MIYAGAWA for L.
80              
81             =head1 ATTRIBUTES
82              
83             =head2 media
84              
85             Will look for any elements of the type (as long as
86             xmlns:media='http://search.yahoo.com/mrss/').
87              
88             In SCALAR context it will return the first sich element, in list context
89             it will return all such elements as a list.
90              
91             =head2 media_groups
92              
93             Like L, but will return a array ref in SCALAR context, and the list
94             in list context.
95              
96              
97              
98             =head2 element_ns
99              
100             Returns the L object representing our
101             xmlns:media="http://search.yahoo.com/mrss/">.
102              
103              
104              
105             =head1 AUTHOR
106              
107             Andreas Marienborg
108              
109             =head1 COPYRIGHT AND LICENSE
110              
111             This software is copyright (c) 2009 by Andreas Marienborg.
112              
113             This is free software; you can redistribute it and/or modify it under
114             the same terms as the Perl 5 programming language system itself.
115              
116             =cut
117              
118              
119              
120             __END__