Added new (currently failing) test for the double-encoding bug.
[catagits/XML-Feed.git] / lib / XML / Feed / Content.pm
CommitLineData
3353d70c 1# $Id$
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', @_) }
5383a560 24sub base { shift->_var('base', @_) }
a749d9b9 25
261;
27__END__
28
29=head1 NAME
30
31XML::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
40I<XML::Feed::Content> represents a content object in an I<XML::Feed::Entry>
41entry in a syndication feed. This could be a I<E<lt>descriptionE<gt>>
42element in an RSS feed, a I<E<lt>contentE<gt>> element in an Atom feed,
43etc. In other words, any element where knowing both the actual data and the
44B<type> of data is useful.
45
46=head1 USAGE
47
8c30ad3d 48=head2 wrap
49
50Take params and turn them into a I<XML::Feed::Content> object.
51
52=head2 new
53
54A synonym for I<wrap>.
55
a749d9b9 56=head2 $content->body
57
58The actual data.
59
60=head2 $content->type
61
62The MIME type of the content in I<body>.
63
64This is really only useful in Atom feeds, because RSS feeds do not specify
65the type of content included in an entry. In RSS feeds, generally the MIME
66type defaults to I<text/html>.
67
5383a560 68=head2 $content->base
69
70The url base of the content.
71
a749d9b9 72=head1 AUTHOR & COPYRIGHT
73
74Please see the I<XML::Feed> manpage for author, copyright, and license
75information.
76
77=cut