| 1 |
package XML::Feed::Enclosure; |
| 2 |
use strict; |
| 3 |
use warnings; |
| 4 |
|
| 5 |
our $VERSION = '1.0.1'; |
| 6 |
|
| 7 |
use base qw( Class::ErrorHandler ); |
| 8 |
|
| 9 |
sub wrap { |
| 10 |
my $class = shift; |
| 11 |
my($c) = @_; |
| 12 |
bless { %$c }, $class; |
| 13 |
} |
| 14 |
*new = \&wrap; |
| 15 |
|
| 16 |
sub _var { |
| 17 |
my $enclosure = shift; |
| 18 |
my $var = shift; |
| 19 |
$enclosure->{$var} = shift if @_; |
| 20 |
$enclosure->{$var}; |
| 21 |
} |
| 22 |
|
| 23 |
sub type { shift->_var('type', @_) } |
| 24 |
sub length { shift->_var('length', @_) } |
| 25 |
sub url { shift->_var('url', @_) } |
| 26 |
|
| 27 |
1; |
| 28 |
__END__ |
| 29 |
|
| 30 |
=head1 NAME |
| 31 |
|
| 32 |
XML::Feed::Enclosure - Wrapper for enclosure objects |
| 33 |
|
| 34 |
=head1 SYNOPSIS |
| 35 |
|
| 36 |
my ($enclosure) = $entry->enclosure; |
| 37 |
print $enclosure->type; |
| 38 |
|
| 39 |
=head1 DESCRIPTION |
| 40 |
|
| 41 |
I<XML::Feed::Enclosure> represents a content object in an I<XML::Feed::Entry> |
| 42 |
entry in a syndication feed. |
| 43 |
|
| 44 |
=head1 USAGE |
| 45 |
|
| 46 |
=head2 wrap |
| 47 |
|
| 48 |
Take params and turn them into a I<XML::Feed::Enclosure> object. |
| 49 |
|
| 50 |
=head2 new |
| 51 |
|
| 52 |
A synonym for I<wrap>. |
| 53 |
|
| 54 |
=head2 $enclosure->url |
| 55 |
|
| 56 |
The url of the object. |
| 57 |
|
| 58 |
=head2 $enclosure->type |
| 59 |
|
| 60 |
The MIME type of the item referred to in I<url>. |
| 61 |
|
| 62 |
=head2 $enclosure->length |
| 63 |
|
| 64 |
The length of object referred to in I<url> |
| 65 |
|
| 66 |
=head1 AUTHOR & COPYRIGHT |
| 67 |
|
| 68 |
Please see the I<XML::Feed> manpage for author, copyright, and license |
| 69 |
information. |
| 70 |
|
| 71 |
=cut |
| 72 |
|