Commit | Line | Data |
973e1f9e |
1 | # $Id: Content.pm 1862 2005-06-20 17:26:11Z btrott $ |
a749d9b9 |
2 | |
3 | package XML::Feed::Content; |
4 | use strict; |
5 | |
62d92771 |
6 | use base qw( Class::ErrorHandler ); |
a749d9b9 |
7 | |
8 | sub wrap { |
9 | my $class = shift; |
10 | my($c) = @_; |
11 | bless { %$c }, $class; |
12 | } |
973e1f9e |
13 | *new = \&wrap; |
a749d9b9 |
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 | |
25 | 1; |
26 | __END__ |
27 | |
28 | =head1 NAME |
29 | |
30 | XML::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 | |
39 | I<XML::Feed::Content> represents a content object in an I<XML::Feed::Entry> |
40 | entry in a syndication feed. This could be a I<E<lt>descriptionE<gt>> |
41 | element in an RSS feed, a I<E<lt>contentE<gt>> element in an Atom feed, |
42 | etc. In other words, any element where knowing both the actual data and the |
43 | B<type> of data is useful. |
44 | |
45 | =head1 USAGE |
46 | |
47 | =head2 $content->body |
48 | |
49 | The actual data. |
50 | |
51 | =head2 $content->type |
52 | |
53 | The MIME type of the content in I<body>. |
54 | |
55 | This is really only useful in Atom feeds, because RSS feeds do not specify |
56 | the type of content included in an entry. In RSS feeds, generally the MIME |
57 | type defaults to I<text/html>. |
58 | |
59 | =head1 AUTHOR & COPYRIGHT |
60 | |
61 | Please see the I<XML::Feed> manpage for author, copyright, and license |
62 | information. |
63 | |
64 | =cut |