| 1 | use strict; | ||
| 2 | use warnings; | ||
| 3 | |||
| 4 | package Net::Google::PicasaWeb::MediaFeed; | ||
| 5 | use Moose; | ||
| 6 | |||
| 7 | extends 'Net::Google::PicasaWeb::Feed'; | ||
| 8 | |||
| 9 | =head1 NAME | ||
| 10 | |||
| 11 | Net::Google::PicasaWeb::MediaFeed - base class for media feed entries | ||
| 12 | |||
| 13 | =head1 DESCRIPTION | ||
| 14 | |||
| 15 | Provides some common functions for the media-based objects (the ones with photo/video links). | ||
| 16 | |||
| 17 | =cut | ||
| 18 | |||
| 19 | has photo => ( | ||
| 20 | is => 'rw', | ||
| 21 | isa => 'Net::Google::PicasaWeb::Media', | ||
| 22 | ); | ||
| 23 | |||
| 24 | override from_feed => sub { | ||
| 25 | my ($class, $service, $entry) = @_; | ||
| 26 | my $self = $class->super($service, $entry); | ||
| 27 | |||
| 28 | if ($entry->has_child('media:group')) { | ||
| 29 | my $media = Net::Google::PicasaWeb::Media->from_feed( | ||
| 30 | $self->service, $entry->first_child('media:group') | ||
| 31 | ); | ||
| 32 | $self->photo($media); | ||
| 33 | } | ||
| 34 | |||
| 35 | return $self; | ||
| 36 | }; | ||
| 37 | |||
| 38 | =head1 AUTHOR | ||
| 39 | |||
| 40 | Andrew Sterling Hanenkamp, C<< <hanenkamp at cpan.org> >> | ||
| 41 | |||
| 42 | =head1 COPYRIGHT & LICENSE | ||
| 43 | |||
| 44 | Copyright 2008 Andrew Sterling Hanenkamp | ||
| 45 | |||
| 46 | This program is free software; you can redistribute it and/or modify it | ||
| 47 | under the same terms as Perl itself. | ||
| 48 | |||
| 49 | =cut | ||
| 50 | |||
| 51 | 1; |