Load XML-Feed-0.06 into trunk.
[catagits/XML-Feed.git] / lib / XML / Feed / Content.pm
CommitLineData
973e1f9e 1# $Id: Content.pm 1862 2005-06-20 17:26:11Z btrott $
a749d9b9 2
3package XML::Feed::Content;
4use strict;
5
62d92771 6use base qw( Class::ErrorHandler );
a749d9b9 7
8sub wrap {
9 my $class = shift;
10 my($c) = @_;
11 bless { %$c }, $class;
12}
973e1f9e 13*new = \&wrap;
a749d9b9 14
15sub _var {
16 my $content = shift;
17 my $var = shift;
18 $content->{$var} = shift if @_;
19 $content->{$var};
20}
21
22sub type { shift->_var('type', @_) }
23sub body { shift->_var('body', @_) }
24
251;
26__END__
27
28=head1 NAME
29
30XML::Feed::Content - Wrapper for content objects
31
32=head1 SYNOPSIS
33
34 my $content = $entry->content;
35 print $content->body;
36
37=head1 DESCRIPTION
38
39I<XML::Feed::Content> represents a content object in an I<XML::Feed::Entry>
40entry in a syndication feed. This could be a I<E<lt>descriptionE<gt>>
41element in an RSS feed, a I<E<lt>contentE<gt>> element in an Atom feed,
42etc. In other words, any element where knowing both the actual data and the
43B<type> of data is useful.
44
45=head1 USAGE
46
47=head2 $content->body
48
49The actual data.
50
51=head2 $content->type
52
53The MIME type of the content in I<body>.
54
55This is really only useful in Atom feeds, because RSS feeds do not specify
56the type of content included in an entry. In RSS feeds, generally the MIME
57type defaults to I<text/html>.
58
59=head1 AUTHOR & COPYRIGHT
60
61Please see the I<XML::Feed> manpage for author, copyright, and license
62information.
63
64=cut