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