/[XML-Feed]/lib/XML/Feed/Content.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /lib/XML/Feed/Content.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations)
Sun Mar 16 19:47:49 2008 UTC (16 years, 1 month ago) by dpavlin
File size: 1336 byte(s)
import XML::Feed 0.12 from CPAN

1 # $Id: Content.pm 1862 2005-06-20 17:26:11Z btrott $
2
3 package XML::Feed::Content;
4 use strict;
5
6 use base qw( Class::ErrorHandler );
7
8 sub wrap {
9 my $class = shift;
10 my($c) = @_;
11 bless { %$c }, $class;
12 }
13 *new = \&wrap;
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

  ViewVC Help
Powered by ViewVC 1.1.26