blib/lib/XML/Atom/SimpleFeed.pm

filter: Statementstmt 84.5% 148 / 175 Branchbran 57.7% 52 / 90 Conditioncond 56.0% 14 / 25 MC/DCmcdc 26.6% 4 / 15 Subroutinesub 91.1% 31 / 34 Podpod 16.0% 4 / 25 totaltotal 69.5% 253 / 364 CC 56 SCAR 24.8
CC
56
Cov
74%
text_construct
49.1
container_content
16.5
natural_enum
12.0
CRAP 11.9
↑ Summary
1 6 ▶use 5.008001; # no good Unicode support? you lose
Subroutine BEGIN: called CC=1 SCAR=0.0
2 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package XML::Atom::SimpleFeed;
6 6 our $VERSION = '0.905';
7  
8 6 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 6 ▶use Encode ();
Subroutine BEGIN: called CC=1 SCAR=0.0
10 6 ▶use POSIX ();
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 6 my @XML_ENC = 'us-ascii'; # use array because local($myvar) error but local($myvar[0]) OK
13 # and use a lexical because not a public interface
14  
15 sub ATOM_NS () { 'http://www.w3.org/2005/Atom' }
16 sub XHTML_NS () { 'http://www.w3.org/1999/xhtml' }
17 7 ▶sub PREAMBLE () { qq(<?xml version="1.0" encoding="$XML_ENC[0]"?>\n) }
Subroutine PREAMBLE: called CC=1 SCAR=0.0
Pod undocumented
18 sub W3C_DATETIME () { '%Y-%m-%dT%H:%M:%S' }
19 4 ▶sub DEFAULT_GENERATOR () { {
Subroutine DEFAULT_GENERATOR: called CC=2 SCAR=7.6
Pod undocumented
20 4 ▶ uri => 'https://metacpan.org/pod/' . __PACKAGE__,
Condition50%1/2
__PACKAGE__->VERSION || 'git'
l!l
40
MC/DC0%0/1
__PACKAGE__->VERSION || 'git'
__PACKAGE__->VERSION
Truth table50%1/2
A
A= __PACKAGE__->VERSION
Aresult
11
00
21 version => __PACKAGE__->VERSION || 'git',
22 name => __PACKAGE__,
23 } }
24  
25 ####################################################################
26 # superminimal XML writer
27 #
28  
29 2 ▶sub xml_encoding { local $XML_ENC[0] = shift; &{(shift)} }
Subroutine xml_encoding: called CC=1 SCAR=0.0
Pod undocumented
30  
31 6 my %XML_ESC = (
32 "\xA" => '&#10;',
33 "\xD" => '&#13;',
34 '"' => '&#34;',
35 '&' => '&#38;',
36 "'" => '&#39;',
37 '<' => '&lt;',
38 '>' => '&gt;',
39 );
40  
41 63 ▶sub xml_cref { Encode::encode $XML_ENC[0], $_[0], Encode::HTMLCREF }
Subroutine xml_cref: called CC=1 SCAR=0.0
Pod undocumented
42  
43 40 ▶sub xml_escape {
Subroutine xml_escape: called CC=1 SCAR=0.0
Pod undocumented
44 40 $_[0] =~ s{ ( [<>&'"] ) }{ $XML_ESC{ $1 } }gex;
45 40 &xml_cref;
46 }
47  
48 22 ▶sub xml_attr_escape {
Subroutine xml_attr_escape: called CC=1 SCAR=0.0
Pod undocumented
49 22 $_[0] =~ s{ ( [\x0A\x0D<>&'"] ) }{ $XML_ESC{ $1 } }gex;
50 22 &xml_cref;
51 }
52  
53 1 ▶sub xml_cdata_flatten {
Subroutine xml_cdata_flatten: called CC=3 SCAR=11.0
Pod undocumented
54 1 for ( $_[0] ) {
55 1 my $cdata_content;
56 1 s{<!\[CDATA\[(.*?)]]>}{ xml_escape $cdata_content = $1 }gse;
57 1 ▶ croak 'Incomplete CDATA section' if -1 < index $_, '<![CDATA[';
Branch: 1 branch
BranchTrueFalseTotal
if index($_, "<![CDATA[") != -1 0 1 1
58 1 return $_;
59 }
60 }
61  
62 1 ▶sub xml_string { xml_cref xml_cdata_flatten $_[ 0 ] }
Subroutine xml_string: called CC=1 SCAR=0.0
Pod undocumented
63  
64 57 ▶sub xml_tag {
Subroutine xml_tag: called CC=4 SCAR=13.9
Pod undocumented
65 57 my $name = shift;
66 57 my $attr = '';
67 57 ▶ if( ref $name eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $name eq "ARRAY") 25 32 57
68 25 my $i = 1;
69 25 ▶ while( $i < @$name ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @$name) 20 25 45
70 20 $attr .= ' ' . $name->[ $i ] . '="' . xml_attr_escape( $name->[ $i + 1 ] ) . '"';
71 20 $i += 2;
72 }
73 25 $name = $name->[ 0 ];
74 }
75 57 ▶ @_ ? join( '', "<$name$attr>", @_, "</$name>" ) : "<$name$attr/>";
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 50 7 57
76 }
77  
78 ####################################################################
79 # misc utility functions
80 #
81  
82 0 ▶sub natural_enum {
Subroutine natural_enum: not called CC=3 SCAR=24.8
Pod undocumented
83 0 my @and;
84 0 ▶ unshift @and, pop @_ if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
85 0 ▶ unshift @and, join ', ', @_ if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
86 0 join ' and ', @and;
87 }
88  
89 3 ▶sub permalink {
Subroutine permalink: called CC=4 SCAR=15.2
Pod undocumented
90 3 my ( $link_arg ) = ( @_ );
91 3 ▶ if( ref $link_arg ne 'HASH' ) {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $link_arg ne 'HASH') { } 2 1 3
elsif (not exists $link_arg->{'rel'} or $link_arg->{'rel'} eq 'alternate') { } 0 1 1
92 2 return $link_arg;
93 }
94 ▶ elsif( not exists $link_arg->{ rel } or $link_arg->{ rel } eq 'alternate' ) {
Condition33%1/3
not exists $link_arg->{"rel"} or $link_arg->{"rel"} eq "alternate"
l!l&&r!l&&!r
001
MC/DC0%0/2
not exists $link_arg->{"rel"} or $link_arg->{"rel"} eq "alternate"
not exists $link_arg->{"rel"} $link_arg->{"rel"} eq "alternate"
Truth table33%1/3
not(A) or B
A= not exists $link_arg->{"rel"}B= $link_arg->{"rel"} eq "alternate"
ABresult
1X1
011
000
95 0 return $link_arg->{ href };
96 }
97 1 return;
98 }
99  
100 ####################################################################
101 # actual implementation of RFC 4287
102 #
103  
104 8 ▶sub simple_construct {
Subroutine simple_construct: called CC=1 SCAR=0.0
Pod undocumented
105 8 my ( $name, $content ) = @_;
106 8 xml_tag $name, xml_escape $content;
107 }
108  
109 11 ▶sub date_construct {
Subroutine date_construct: called CC=2 SCAR=6.9
Pod undocumented
110 11 my ( $name, $dt ) = @_;
111 11 eval { $dt = $dt->epoch }; # convert to epoch to avoid dealing with everyone's TZ crap
112 11 ▶ $dt = POSIX::strftime( W3C_DATETIME . 'Z', gmtime $dt ) unless $dt =~ /[^0-9]/;
Branch: 1 branch
BranchTrueFalseTotal
unless $dt =~ /[^0-9]/ 9 2 11
113 11 xml_tag $name, xml_escape $dt;
114 }
115  
116 3 ▶sub person_construct {
Subroutine person_construct: called CC=3 SCAR=11.2
Pod undocumented
117 3 my ( $name, $arg ) = @_;
118  
119 3 ▶ my $prop = 'HASH' ne ref $arg ? { name => $arg } : $arg;
Branch: 1 branch
BranchTrueFalseTotal
'HASH' ne ref $arg ? : 3 0 3
120  
121 3 ▶ croak "name required for $name element" if not exists $prop->{ name };
Branch: 1 branch
BranchTrueFalseTotal
unless exists $prop->{"name"} 0 3 3
122  
123 return xml_tag $name => (
124 3 map { xml_tag $_ => xml_escape $prop->{ $_ } }
125 3 grep { exists $prop->{ $_ } }
126 qw( name email uri )
127 );
128 }
129  
130 9 ▶sub text_construct {
Subroutine text_construct: called CC=12 SCAR=38.9
Pod undocumented
131 9 my ( $name, $arg ) = @_;
132  
133 9 my ( $type, $content );
134  
135 9 ▶ if( ref $arg eq 'HASH' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $arg eq 'HASH') { } 0 9 9
136 # FIXME doesn't support @src attribute for $name eq 'content' yet
137  
138 0 ▶ $type = exists $arg->{ type } ? $arg->{ type } : 'html';
Branch: 1 branch
BranchTrueFalseTotal
exists $arg->{'type'} ? : 0 0 0
139  
140 0 ▶ croak "content required for $name element" unless exists $arg->{ content };
Branch: 1 branch
BranchTrueFalseTotal
unless exists $arg->{"content"} 0 0 0
141  
142 # a lof of the effort that follows is to omit the type attribute whenever possible
143 #
144 0 ▶ if( $type eq 'xhtml' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($type eq 'xhtml') { } 0 0 0
elsif ($type eq 'html' or $type eq 'text') { } 0 0 0
145 0 $content = xml_string $arg->{ content };
146  
147 0 ▶ if( $content !~ /</ ) { # FIXME does this cover all cases correctly?
Branch: 1 branch
BranchTrueFalseTotal
if (not $content =~ /</) { } 0 0 0
148 0 $type = 'text';
149 0 $content =~ s/[\n\t]+/ /g;
150 }
151 else {
152 0 $content = xml_tag [ div => xmlns => XHTML_NS ], $content;
153 }
154 }
155 ▶ elsif( $type eq 'html' or $type eq 'text' ) {
Condition0%0/3
$type eq "html" or $type eq "text"
l!l&&r!l&&!r
000
MC/DC0%0/2
$type eq "html" or $type eq "text"
$type eq "html" $type eq "text"
Truth table0%0/3
A or B
A= $type eq "html"B= $type eq "text"
ABresult
1X1
011
000
156 0 $content = xml_escape $arg->{ content };
157 }
158 else {
159 0 ▶ croak "type '$type' not allowed in $name element"
Branch: 1 branch
BranchTrueFalseTotal
if $name ne "content" 0 0 0
160 if $name ne 'content';
161  
162 # FIXME non-XML/text media types must be base64 encoded!
163 0 $content = xml_string $arg->{ content };
164 }
165 }
166 else {
167 9 $type = 'html';
168 9 $content = xml_escape $arg;
169 }
170  
171 9 ▶ if( $type eq 'html' and $content !~ /&/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type eq "html" and not $content =~ /&/) 8 1 9
Condition66%2/3
$type eq "html" and not $content =~ /&/
!ll&&!rl&&r
018
MC/DC50%1/2
$type eq "html" and not $content =~ /&/
$type eq "html" not $content =~ /&/
Truth table66%2/3
A and not(B)
A= $type eq "html"B= not $content =~ /&/
ABresult
0X0
100
111
172 8 $type = 'text';
173 8 $content =~ s/[\n\t]+/ /g;
174 }
175  
176 9 ▶ return xml_tag [ $name => $type ne 'text' ? ( type => $type ) : () ], $content;
Branch: 1 branch
BranchTrueFalseTotal
$type ne 'text' ? : 1 8 9
177 }
178  
179 3 ▶sub link_element {
Subroutine link_element: called CC=6 SCAR=18.5
Pod undocumented
180 3 my ( $name, $arg ) = @_;
181  
182 # omit atom:link/@rel value when possible
183 delete $arg->{'rel'}
184 if 'HASH' eq ref $arg
185 and exists $arg->{'rel'}
186 3 ▶ and 'alternate' eq $arg->{'rel'};
Branch: 1 branch
BranchTrueFalseTotal
if "HASH" eq ref $arg and exists $arg->{"rel"} and "alternate" eq $arg->{"rel"} 0 3 3
Condition66%4/6
"HASH" eq ref $arg and exists $arg->{"rel"} and "alternate" eq $arg->{"rel"}
!ll&&!rl&&r
210
"HASH" eq ref $arg and exists $arg->{"rel"}
!ll&&!rl&&r
201
MC/DC0%0/3
"HASH" eq ref $arg and exists $arg->{"rel"} and "alternate" eq $arg->{"rel"}
"HASH" eq ref $arg exists $arg->{"rel"} "alternate" eq $arg->{"rel"}
Truth table50%2/4
A and B and C
A= "HASH" eq ref $argB= exists $arg->{"rel"}C= "alternate" eq $arg->{"rel"}
ABCresult
0XX0
10X0
1100
1111
187  
188 my @attr = 'HASH' eq ref $arg
189 3 ▶ ? do {
Branch: 1 branch
BranchTrueFalseTotal
'HASH' eq ref $arg ? : 1 2 3
190 1 ▶ croak "href required for link element" if not exists $arg->{'href'};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $arg->{"href"} 0 1 1
191 1 map { $_ => $arg->{ $_ } } grep exists $arg->{ $_ }, qw( href rel type title hreflang length );
192 }
193 : ( href => $arg );
194  
195 # croak "link '$attr[1]' is not a valid URI"
196 # if $attr[1] XXX TODO
197  
198 3 xml_tag [ link => @attr ];
199 }
200  
201 2 ▶sub category_element {
Subroutine category_element: called CC=3 SCAR=16.0
Pod undocumented
202 2 my ( $name, $arg ) = @_;
203  
204 my @attr = 'HASH' eq ref $arg
205 2 ▶ ? do {
Branch: 1 branch
BranchTrueFalseTotal
'HASH' eq ref $arg ? : 0 2 2
206 0 ▶ croak "term required for category element" if not exists $arg->{'term'};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $arg->{"term"} 0 0 0
207 0 map { $_ => $arg->{ $_ } } grep exists $arg->{ $_ }, qw( term scheme label );
208 }
209 : ( term => $arg );
210  
211 2 xml_tag [ category => @attr ];
212 }
213  
214 7 ▶sub generator_element {
Subroutine generator_element: called CC=4 SCAR=13.9
Pod undocumented
215 7 my ( $name, $arg ) = @_;
216 7 ▶ if( ref $arg eq 'HASH' ) {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $arg eq 'HASH') { } 2 5 7
elsif (defined $arg) { } 4 1 5
217 2 ▶ croak 'name required for generator element' if not exists $arg->{ name };
Branch: 1 branch
BranchTrueFalseTotal
unless exists $arg->{"name"} 0 2 2
218 2 my $content = delete $arg->{ name };
219 2 xml_tag [ generator => map +( $_ => $arg->{ $_ } ), grep exists $arg->{ $_ }, qw( uri version ) ], xml_escape( $content );
220 }
221 elsif( defined $arg ) {
222 4 xml_tag generator => xml_escape( $arg );
223 }
224 1 else { '' }
225 }
226  
227 # tag makers are called with the name of the tag they're supposed to handle as the first parameter
228 6 my %make_tag = (
229 icon => \&simple_construct,
230 id => \&simple_construct,
231 logo => \&simple_construct,
232 published => \&date_construct,
233 updated => \&date_construct,
234 author => \&person_construct,
235 contributor => \&person_construct,
236 title => \&text_construct,
237 subtitle => \&text_construct,
238 rights => \&text_construct,
239 summary => \&text_construct,
240 content => \&text_construct,
241 link => \&link_element,
242 category => \&category_element,
243 generator => \&generator_element,
244 );
245  
246 8 ▶sub container_content {
Subroutine container_content: called CC=15 SCAR=28.1
Pod undocumented
247 8 my ( $name, %arg ) = @_;
248  
249 my ( $elements, $required, $optional, $singular, $deprecation, $callback ) =
250 8 @arg{ qw( elements required optional singular deprecate callback ) };
251  
252 8 my ( $content, %permission, %count, $permalink );
253  
254 8 undef @permission{ @$required, @$optional }; # populate
255  
256 8 ▶ while( my ( $elem, $arg ) = splice @$elements, 0, 2 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = splice(@$elements, 0, 2)) 36 8 44
257 36 ▶ if( exists $permission{ $elem } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $permission{$elem}) { } 36 0 36
258 36 $content .= $make_tag{ $elem }->( $elem, $arg );
259 36 ++$count{ $elem };
260 }
261 else {
262 0 croak "Unknown element $elem";
263 }
264  
265 36 ▶ if( $elem eq 'link' and defined ( my $alt = permalink $arg ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($elem eq "link" and defined(my $alt = permalink($arg))) 2 34 36
Condition100%3/3
$elem eq "link" and defined(my $alt = permalink($arg))
!ll&&!rl&&r
3312
MC/DC100%2/2
$elem eq "link" and defined(my $alt = permalink($arg))
$elem eq "link" defined(my $alt = permalink($arg))
Truth table100%3/3
A and B
A= $elem eq "link"B= defined(my $alt = permalink($arg))
ABresult
0X0
100
111
266 2 ▶ $permalink = $alt unless $count{ 'alternate link' }++;
Branch: 1 branch
BranchTrueFalseTotal
unless $count{"alternate link"}++ 2 0 2
267 }
268  
269 36 ▶ if( exists $callback->{ $elem } ) { $callback->{ $elem }->( $arg ) }
Branch: 1 branch
BranchTrueFalseTotal
if (exists $callback->{$elem}) 13 23 36
270  
271 36 ▶ if( not @$elements ) { # end of input?
Branch: 1 branch
BranchTrueFalseTotal
unless (@$elements) 11 25 36
272 # we would normally fall off the bottom of the loop now;
273 # before that happens, it's time to defaultify stuff and
274 # put it in the input so we will keep going for a little longer
275 11 ▶ if( not $count{ id } and defined $permalink ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $count{"id"} and defined $permalink) 0 11 11
Condition33%1/3
not $count{"id"} and defined $permalink
!ll&&!rl&&r
1100
MC/DC0%0/2
not $count{"id"} and defined $permalink
not $count{"id"} defined $permalink
Truth table33%1/3
not(A) and B
A= not $count{"id"}B= defined $permalink
ABresult
0X0
100
111
276 0 carp 'Falling back to alternate link as id';
277 0 push @$elements, id => $permalink;
278 }
279 11 ▶ if( not $count{ updated } ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($count{"updated"}) 3 8 11
280 3 push @$elements, updated => $arg{ default_upd };
281 }
282 }
283 }
284  
285 8 my @error;
286  
287 8 my @missing = grep { not exists $count{ $_ } } @$required;
288 8 ▶ my @toomany = grep { ( $count{ $_ } || 0 ) > 1 } 'alternate link', @$singular;
Condition100%2/2
$count{$_} || 0
l!l
3039
MC/DC100%1/1
$count{$_} || 0
$count{$_}
Truth table100%2/2
A
A= $count{$_}
Aresult
11
00
289  
290 8 ▶ push @error, 'requires at least one ' . natural_enum( @missing ) . ' element' if @missing;
Branch: 1 branch
BranchTrueFalseTotal
if @missing 0 8 8
291 8 ▶ push @error, 'must have no more than one ' . natural_enum( @toomany ) . ' element' if @toomany;
Branch: 1 branch
BranchTrueFalseTotal
if @toomany 0 8 8
292  
293 8 ▶ croak $name, ' ', join ' and ', @error if @error;
Branch: 1 branch
BranchTrueFalseTotal
if @error 0 8 8
294  
295 8 return $content;
296 }
297  
298 ####################################################################
299 # implementation of published interface and rest of RFC 4287
300 #
301  
302 7 ▶sub XML::Atom::SimpleFeed::new {
Subroutine new: called CC=4 SCAR=14.0
Pod documented
303 7 my $self = bless { xml_encoding => $XML_ENC[0] }, shift;
304  
305 7 ▶ if ( my @i = grep { '-encoding' eq $_[$_] } grep { not $_ % 2 } 0 .. $#_ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@i) = grep({"-encoding" eq $_[$_];} grep({not $_ % 2;} 0 .. $#_))) 2 5 7
306 2 ▶ croak 'multiple encodings requested' if @i > 1;
Branch: 1 branch
BranchTrueFalseTotal
if @i > 1 0 2 2
307 2 ( undef, my $encoding ) = splice @_, $i[0], 2;
308 2 $self->{ xml_encoding } = $encoding;
309 }
310  
311 7 ▶ @_ ? $self->feed( @_ ) : $self;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 7 0 7
312 }
313  
314 7 ▶sub XML::Atom::SimpleFeed::feed {
Subroutine feed: called CC=2 SCAR=6.9
Pod undocumented
315 7 my $self = shift;
316  
317 7 my $have_generator;
318  
319 7 local $XML_ENC[0] = $self->{ xml_encoding };
320 $self->{ meta } = container_content feed => (
321 elements => \@_,
322 required => [ qw( id title updated ) ],
323 optional => [ qw( author category contributor generator icon logo link rights subtitle ) ],
324 singular => [ qw( generator icon logo id rights subtitle title updated ) ],
325 callback => {
326 1 ▶ author => sub { $self->{ have_default_author } = 1 },
Subroutine __ANON__: called CC=1 SCAR=0.0
327 7 ▶ updated => sub { $self->{ global_updated } = $_[ 0 ] },
Subroutine __ANON__: called CC=1 SCAR=0.0
328 5 ▶ generator => sub { $have_generator = 1 },
Subroutine __ANON__: called CC=1 SCAR=0.0
329 },
330 7 default_upd => time,
331 );
332  
333 7 ▶ $self->{ meta } .= $make_tag{ generator }->( generator => DEFAULT_GENERATOR )
Branch: 1 branch
BranchTrueFalseTotal
unless $have_generator 2 5 7
334 unless $have_generator;
335  
336 7 return $self;
337 }
338  
339 1 ▶sub XML::Atom::SimpleFeed::add_entry {
Subroutine add_entry: called CC=2 SCAR=6.9
Pod documented
340 1 my $self = shift;
341  
342 1 my @required = qw( id title updated );
343 1 my @optional = qw( category content contributor link published rights summary );
344  
345 1 ▶ push @{ $self->{ have_default_author } ? \@optional : \@required }, 'author';
Branch: 1 branch
BranchTrueFalseTotal
$self->{'have_default_author'} ? : 1 0 1
346  
347 # FIXME
348 #
349 # o atom:entry elements that contain no child atom:content element
350 # MUST contain at least one atom:link element with a rel attribute
351 # value of "alternate".
352 #
353 # o atom:entry elements MUST contain an atom:summary element in either
354 # of the following cases:
355 # * the atom:entry contains an atom:content that has a "src"
356 # attribute (and is thus empty).
357 # * the atom:entry contains content that is encoded in Base64;
358 # i.e., the "type" attribute of atom:content is a MIME media type
359 # [MIMEREG], but is not an XML media type [RFC3023], does not
360 # begin with "text/", and does not end with "/xml" or "+xml".
361  
362 1 local $XML_ENC[0] = $self->{ xml_encoding };
363 1 push @{ $self->{ entries } }, xml_tag entry => container_content entry => (
364 elements => \@_,
365 required => \@required,
366 optional => \@optional,
367 singular => [ qw( content id published rights summary ) ],
368 default_upd => $self->{ global_updated },
369 1 );
370  
371 1 return $self;
372 }
373  
374 7 ▶sub XML::Atom::SimpleFeed::as_string {
Subroutine as_string: called CC=1 SCAR=0.0
Pod documented
375 7 my $self = shift;
376 7 local $XML_ENC[0] = $self->{ xml_encoding };
377 7 PREAMBLE . xml_tag [ feed => xmlns => ATOM_NS ], $self->{ meta }, @{ $self->{ entries } };
378 }
379  
380 0 ▶sub XML::Atom::SimpleFeed::print {
Subroutine print: not called CC=2 SCAR=17.9
Pod documented
381 0 my $self = shift;
382 0 my ( $handle ) = @_;
383 0 local $, = local $\ = '';
384 0 ▶ defined $handle ? print $handle $self->as_string : print $self->as_string;
Branch: 1 branch
BranchTrueFalseTotal
defined $handle ? : 0 0 0
385 }
386  
387 0 ▶sub XML::Atom::SimpleFeed::save_file { croak q{no longer supported, use 'print' instead and pass in a filehandle} }
Subroutine save_file: not called CC=1 SCAR=6.9
Pod undocumented
388  
389 6 !!'Funky and proud of it.';
390  
391 __END__
↑ Summary