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