Media.pm

filter: Statementstmt 100% 25 / 25 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 100% 1 / 1 totaltotal 100% 35 / 35 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Media/Thumbnail.pm ↑ Summary Media/Base.pm »
1 package XML::Atom::Ext::Media;
2 2 our $VERSION = '0.092840';
3  
4  
5 # ABSTRACT: An XML::Atom extenstion for the yahoo Media RSS extension
6  
7 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 ▶use base qw( XML::Atom::Base );
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 2 ▶use XML::Atom::Feed;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 2 ▶use XML::Atom::Ext::Media::Group;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 2 ▶use XML::Atom::Ext::Media::Content;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 2 ▶use XML::Atom::Ext::Media::Thumbnail;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18  
19  
20 2 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
21 2 XML::Atom::Entry->mk_object_list_accessor(
22 group => 'XML::Atom::Ext::Media::Group',
23 'media_groups',
24 );
25 # XXX: This conflicts with <entry><content>, 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 6 ▶sub element_ns {
Subroutine element_ns: called CC=1 SCAR=0.0
Pod documented
33 6 return XML::Atom::Namespace->new(
34 "media" => q{http://search.yahoo.com/mrss/}
35 );
36 }
37  
38 2 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<ATTRIBUTES> we describe here end up on L<XML::Atom::Entry>-objects, except
74 for L<element_ns>.
75  
76 =head1 ACKNOWLEDGEMENTS
77  
78 Thank you to L<XML::Atom::Ext::OpenSearch> for being invaluable aid in figuring out
79 how to write extension for L<XML::Atom>. Thank you to MIYAGAWA for L<XML::Atom>.
80  
81 =head1 ATTRIBUTES
82  
83 =head2 media
84  
85 Will look for any elements of the type <media:group> (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<media>, 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<XML::Atom::Namespace> object representing our
101 xmlns:media="http://search.yahoo.com/mrss/">.
102  
103  
104  
105 =head1 AUTHOR
106  
107 Andreas Marienborg <andremar@cpan.org>
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__
« Media/Thumbnail.pm ↑ Summary Media/Base.pm »