blib/lib/XML/Feed/Content.pm

filter: Statementstmt 100% 22 / 22 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 100% 4 / 4 totaltotal 100% 36 / 36 CC 2 SCAR 2.0
CC
2
Cov
100%
_var
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« blib/lib/XML/Feed/Format/Atom.pm ↑ Summary blib/lib/XML/Feed/Enclosure.pm »
1 package XML::Feed::Content;
2 35 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 35 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 35 our $VERSION = '0.65';
6  
7 35 ▶use base qw( Class::ErrorHandler );
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 sub wrap {
10 23 ▶ my $class = shift;
Subroutine wrap: called CC=1 SCAR=0.0
Pod documented
11 23 my($c) = @_;
12 23 bless { %$c }, $class;
13 }
14 35 *new = \&wrap;
15  
16 sub _var {
17 45 ▶ my $content = shift;
Subroutine _var: called CC=2 SCAR=6.9
18 45 my $var = shift;
19 45 ▶ $content->{$var} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 1 44 45
20 45 $content->{$var};
21 }
22  
23 15 ▶sub type { shift->_var('type', @_) }
Subroutine type: called CC=1 SCAR=0.0
Pod documented
24 20 ▶sub body { shift->_var('body', @_) }
Subroutine body: called CC=1 SCAR=0.0
Pod documented
25 10 ▶sub base { shift->_var('base', @_) }
Subroutine base: called CC=1 SCAR=0.0
Pod documented
26  
27 35 1;
28 __END__
29  
30 =head1 NAME
31  
32 XML::Feed::Content - Wrapper for content objects
33  
34 =head1 SYNOPSIS
35  
36 my $content = $entry->content;
37 print $content->body;
38  
39 =head1 DESCRIPTION
40  
41 I<XML::Feed::Content> represents a content object in an I<XML::Feed::Entry>
42 entry in a syndication feed. This could be a I<E<lt>descriptionE<gt>>
43 element in an RSS feed, a I<E<lt>contentE<gt>> element in an Atom feed,
44 etc. In other words, any element where knowing both the actual data and the
45 B<type> of data is useful.
46  
47 =head1 USAGE
48  
49 =head2 wrap
50  
51 Take params and turn them into a I<XML::Feed::Content> object.
52  
53 =head2 new
54  
55 A synonym for I<wrap>.
56  
57 =head2 $content->body
58  
59 The actual data.
60  
61 =head2 $content->type
62  
63 The MIME type of the content in I<body>.
64  
65 This is really only useful in Atom feeds, because RSS feeds do not specify
66 the type of content included in an entry. In RSS feeds, generally the MIME
67 type defaults to I<text/html>.
68  
69 =head2 $content->base
70  
71 The url base of the content.
72  
73 =head1 AUTHOR & COPYRIGHT
74  
75 Please see the I<XML::Feed> manpage for author, copyright, and license
76 information.
77  
78 =cut
« blib/lib/XML/Feed/Format/Atom.pm ↑ Summary blib/lib/XML/Feed/Enclosure.pm »