Add pod and coverage tests
[catagits/XML-Feed.git] / lib / XML / Feed / Content.pm
1 # $Id: Content.pm 1862 2005-06-20 17:26:11Z btrott $
2
3 package XML::Feed::Content;
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 $content = shift;
17     my $var = shift;
18     $content->{$var} = shift if @_;
19     $content->{$var};
20 }
21
22 sub type { shift->_var('type', @_) }
23 sub body { shift->_var('body', @_) }
24 sub base { shift->_var('base', @_) }
25
26 1;
27 __END__
28
29 =head1 NAME
30
31 XML::Feed::Content - Wrapper for content objects
32
33 =head1 SYNOPSIS
34
35     my $content = $entry->content;
36     print $content->body;
37
38 =head1 DESCRIPTION
39
40 I<XML::Feed::Content> represents a content object in an I<XML::Feed::Entry>
41 entry in a syndication feed. This could be a I<E<lt>descriptionE<gt>>
42 element in an RSS feed, a I<E<lt>contentE<gt>> element in an Atom feed,
43 etc. In other words, any element where knowing both the actual data and the
44 B<type> of data is useful.
45
46 =head1 USAGE
47
48 =head2 wrap
49
50 Take params and turn them into a I<XML::Feed::Content> object.
51
52 =head2 new
53
54 A synonym for I<wrap>.
55
56 =head2 $content->body
57
58 The actual data.
59
60 =head2 $content->type
61
62 The MIME type of the content in I<body>.
63
64 This is really only useful in Atom feeds, because RSS feeds do not specify
65 the type of content included in an entry. In RSS feeds, generally the MIME
66 type defaults to I<text/html>.
67
68 =head2 $content->base
69
70 The url base of the content.
71
72 =head1 AUTHOR & COPYRIGHT
73
74 Please see the I<XML::Feed> manpage for author, copyright, and license
75 information.
76
77 =cut