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