blib/lib/XML/Loy/Atom.pm

filter: Statementstmt 95.3% 186 / 195 Branchbran 80.7% 84 / 104 Conditioncond 66.6% 20 / 30 MC/DCmcdc 47.3% 9 / 19 Subroutinesub 100% 34 / 34 Podpod 100% 19 / 19 totaltotal 87.7% 352 / 401 CC 67 SCAR 17.4
CC
67
Cov
88%
new_text
13.3
_addset_text
10.5
entry
9.3
CRAP 5.7
« lib/XML/Loy/GeoRSS.pm ↑ Summary blib/lib/XML/Loy/Atom/Threading.pm »
1 package XML::Loy::Atom;
2 9 ▶use Carp qw/carp/;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 9 ▶use Mojo::ByteStream 'b';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 9 ▶use XML::Loy::Date::RFC3339;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 # Todo:
9 # - see http://search.cpan.org/dist/XML-Atom-SimpleFeed
10  
11 9 our @CARP_NOT;
12  
13 # Make it an XML::Loy base class
14 9 ▶use XML::Loy with => (
Subroutine BEGIN: called CC=1 SCAR=0.0
15 mime => 'application/atom+xml',
16 prefix => 'atom',
17 namespace => 'http://www.w3.org/2005/Atom'
18 9 );
19  
20  
21 # Namespace declaration
22 9 state $XHTML_NS = 'http://www.w3.org/1999/xhtml';
23  
24  
25 # New person construct
26 3 ▶sub new_person {
Subroutine new_person: called CC=2 SCAR=6.9
Pod documented
27 3 my $self = shift;
28 3 my $person = ref($self)->SUPER::new('person');
29  
30 3 my %hash = @_;
31 3 $person->set($_ => $hash{$_}) foreach keys %hash;
32 3 return $person;
33 };
34  
35  
36 # New text construct
37 47 ▶sub new_text {
Subroutine new_text: called CC=13 SCAR=25.9
Pod documented
38 47 my $self = shift;
39  
40 47 ▶ return unless $_[0];
Branch: 1 branch
BranchTrueFalseTotal
unless $_[0] 0 47 47
41  
42 47 my $class = ref($self);
43  
44 # Expect empty html
45 47 ▶ unless (defined $_[1]) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $_[1]) 5 42 47
46 5 return $class->SUPER::new(
47 text => {
48 type => 'text',
49 -type => 'raw'
50 } => shift );
51 };
52  
53 42 my ($type, $content, %hash);
54  
55 # Only textual content
56 42 ▶ if (!defined $_[2] && $_[0] =~ m/(?:text|x?html)/) {
Branch: 2 branches
BranchTrueFalseTotal
if (not defined $_[2] and $_[0] =~ /(?:text|x?html)/) { } 21 21 42
elsif (@_ % 2 == 0) { } 21 0 21
Condition100%3/3
not defined $_[2] and $_[0] =~ /(?:text|x?html)/
!ll&&!rl&&r
20121
MC/DC100%2/2
not defined $_[2] and $_[0] =~ /(?:text|x?html)/
not defined $_[2] $_[0] =~ /(?:text|x?html)/
Truth table100%3/3
not(A) and B
A= not defined $_[2]B= $_[0] =~ /(?:text|x?html)/
ABresult
0X0
100
111
57 21 $type = shift;
58 21 $content = shift;
59 }
60  
61 # Hash definition
62 elsif ((@_ % 2) == 0) {
63 21 %hash = @_;
64  
65 21 ▶ $type = delete $hash{type} || 'text';
Condition100%2/2
delete $hash{'type'} || 'text'
l!l
201
MC/DC100%1/1
delete $hash{'type'} || 'text'
delete $hash{'type'}
Truth table100%2/2
A
A= delete $hash{'type'}
Aresult
11
00
66  
67 21 ▶ if (exists $hash{src}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $hash{"src"}) 0 21 21
68 0 return $class->SUPER::new(
69 text => { type => $type, %hash }
70 );
71 };
72  
73 21 ▶ $content = delete $hash{content} or return;
Branch: 1 branch
BranchTrueFalseTotal
$content = delete $hash{"content"} or return 20 1 21
74 };
75  
76 # Content node
77 41 my $c_node;
78  
79 # xhtml
80 41 ▶ if ($type eq 'xhtml') {
Branch: 3 branches
BranchTrueFalseTotal
if ($type eq 'xhtml') { } 11 30 41
elsif ($type eq 'html' or $type =~ /^text/i) { } 25 5 30
elsif ($type =~ m[[/\+]xml(;.+)?$]i) { } 0 5 5
81  
82 # Create new by hash
83 11 $c_node = $class->SUPER::new(
84 text => {
85 type => $type,
86 %hash
87 });
88  
89 # XHTML content - allowed to be pretty printed
90 11 $c_node->add(
91 -div => {
92 xmlns => $XHTML_NS
93 })->append_content($content);
94 }
95  
96 # html or text
97 ▶ elsif ($type eq 'html' || $type =~ /^text/i) {
Condition100%3/3
$type eq "html" or $type =~ /^text/i
l!l&&r!l&&!r
9165
MC/DC100%2/2
$type eq "html" or $type =~ /^text/i
$type eq "html" $type =~ /^text/i
Truth table100%3/3
A or B
A= $type eq "html"B= $type =~ /^text/i
ABresult
1X1
011
000
98  
99 # Content is raw and thus nonindented
100 25 $c_node = $class->new(
101 text => {
102 'type' => $type,
103 '-type' => 'raw',
104 'xml:space' => 'preserve',
105 %hash
106 } => $content . ''
107 );
108 }
109  
110 # xml media type
111 elsif ($type =~ /[\/\+]xml(;.+)?$/i) {
112 0 $c_node = $class->new(
113 text => {
114 type => $type,
115 -type => 'raw',
116 %hash
117 } => $content);
118 }
119  
120 # all other media types
121 else {
122 5 $c_node = $class->new(
123 text => {
124 type => $type,
125 -type => 'armour',
126 %hash
127 },
128 $content);
129 };
130  
131 41 return $c_node;
132 };
133  
134  
135 # Add author information
136 25 ▶sub author {
Subroutine author: called CC=2 SCAR=6.9
Pod documented
137 25 my $self = shift;
138  
139 # Add author
140 25 ▶ return $self->_add_person(author => @_) if $_[0];
Branch: 1 branch
BranchTrueFalseTotal
if $_[0] 14 11 25
141  
142 # Get author information
143 11 return $self->_get_information_array('author');
144 };
145  
146  
147 # Add category information
148 5 ▶sub category {
Subroutine category: called CC=5 SCAR=16.2
Pod documented
149 5 my $self = shift;
150  
151 # Set category
152 5 ▶ if ($_[0]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]) 2 3 5
153 2 ▶ if (!defined $_[1]) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $_[1]) 1 1 2
154 1 return $self->add(category => { term => shift });
155 };
156  
157 1 return $self->add(category => { @_ } );
158 };
159  
160 # Get category
161 3 ▶ my $coll = $self->_get_information_array('category')
Branch: 1 branch
BranchTrueFalseTotal
my $coll = $self->_get_information_array("category") or return 3 0 3
162 or return;
163  
164 3 ▶ if ($coll->[0]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($coll->[0]) 3 0 3
165 3 ▶ $coll->map(sub { $_ = $_->{term} });
Subroutine __ANON__: called CC=1 SCAR=0.0
166 };
167  
168 3 return $coll;
169 };
170  
171  
172 # Add contributor information
173 6 ▶sub contributor {
Subroutine contributor: called CC=2 SCAR=6.9
Pod documented
174 6 my $self = shift;
175  
176 # Add contributor
177 6 ▶ return $self->_add_person(contributor => @_) if $_[0];
Branch: 1 branch
BranchTrueFalseTotal
if $_[0] 3 3 6
178  
179 # Get contributor information
180 3 return $self->_get_information_array('contributor');
181 };
182  
183  
184 # Add content information
185 18 ▶sub content {
Subroutine content: called CC=2 SCAR=6.9
Pod documented
186 18 my $self = shift;
187  
188 # Set content
189 18 ▶ return $self->_addset_text(set => content => @_) if $_[0];
Branch: 1 branch
BranchTrueFalseTotal
if $_[0] 15 3 18
190  
191 # Return content
192 3 return $self->_get_information_single('content');
193 };
194  
195  
196 # Set or get entry
197 15 ▶sub entry {
Subroutine entry: called CC=9 SCAR=22.3
Pod documented
198 15 my $self = shift;
199  
200 # Is object
201 15 ▶ if (ref $_[0]) {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $_[0]) { } 0 15 15
elsif ($_[0] and not $_[1]) { } 5 11 16
202 0 return $self->add(@_);
203 }
204  
205 # Get entry
206 ▶ elsif ($_[0] && !$_[1]) {
Condition100%3/3
$_[0] and not $_[1]
!ll&&!rl&&r
195
MC/DC100%2/2
$_[0] and not $_[1]
$_[0] not $_[1]
Truth table100%3/3
A and not(B)
A= $_[0]B= not $_[1]
ABresult
0X0
100
111
207  
208 5 my $id = shift;
209  
210 # Get based on xml:id
211 5 my $entry = $self->at(qq{entry[xml\\:id="$id"]});
212 5 ▶ return $entry if $entry;
Branch: 1 branch
BranchTrueFalseTotal
if $entry 3 2 5
213  
214 # Get based on <entry><id>id</id></entry>
215 2 ▶ my $idc = $self->find('entry > id')->grep(sub { $_->text eq $id });
Subroutine __ANON__: called CC=1 SCAR=0.0
216  
217 2 ▶ return unless $idc && $idc->[0];
Branch: 1 branch
BranchTrueFalseTotal
unless $idc and $idc->[0] 0 2 2
Condition33%1/3
$idc and $idc->[0]
!ll&&!rl&&r
002
MC/DC0%0/2
$idc and $idc->[0]
$idc $idc->[0]
Truth table33%1/3
A and B
A= $idcB= $idc->[0]
ABresult
0X0
100
111
218  
219 2 return $idc->[0]->parent;
220 };
221  
222 10 my %hash = @_;
223 10 my $entry;
224  
225 # Set id additionally as xml:id
226 10 ▶ if (exists $hash{id}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $hash{'id'}) { } 8 2 10
227 $entry = $self->add(
228 entry => {'xml:id' => $hash{id}}
229 8 );
230 }
231  
232 # No id given
233 else {
234 2 $entry = $self->add('entry');
235 };
236  
237 # Add information
238 10 foreach (keys %hash) {
239 9 $entry->add($_, $hash{$_});
240 };
241  
242 10 return $entry;
243 };
244  
245  
246 # Set or get generator information
247 4 ▶sub generator {
Subroutine generator: called CC=1 SCAR=0.0
Pod documented
248 4 shift->_simple_feed_info(generator => @_);
249 };
250  
251  
252 # Set or get icon information
253 3 ▶sub icon {
Subroutine icon: called CC=1 SCAR=0.0
Pod documented
254 3 shift->_simple_feed_info(icon => @_);
255 };
256  
257  
258 # Add id
259 5 ▶sub id {
Subroutine id: called CC=4 SCAR=14.1
Pod documented
260 5 my $self = shift;
261  
262 # Get id
263 5 ▶ unless ($_[0]) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($_[0]) 2 3 5
264 2 my $id_obj = $self->_get_information_single('id');
265 2 ▶ return $id_obj->text if $id_obj;
Branch: 1 branch
BranchTrueFalseTotal
if $id_obj 2 0 2
266 0 return;
267 };
268  
269 3 my $id = shift;
270 3 my $element = $self->set(id => $id);
271 3 ▶ return unless $element;
Branch: 1 branch
BranchTrueFalseTotal
unless $element 0 3 3
272  
273 # Add xml:id also
274 3 $element->parent->attr('xml:id' => $id);
275 3 return $self;
276 };
277  
278  
279 # Add link information
280 19 ▶sub link {
Subroutine link: called CC=5 SCAR=16.1
Pod documented
281 19 my $self = shift;
282  
283 19 ▶ if ($_[1]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[1]) 11 8 19
284  
285 # rel => href
286 11 ▶ if (@_ == 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 2) 5 6 11
287 5 return $self->add(link => {
288 rel => shift,
289 href => shift
290 });
291 };
292  
293 # Parameter
294 6 my %values = @_;
295 # href, rel, type, hreflang, title, length
296 6 ▶ my $rel = delete $values{rel} || 'related';
Condition50%1/2
delete $values{'rel'} || 'related'
l!l
60
MC/DC0%0/1
delete $values{'rel'} || 'related'
delete $values{'rel'}
Truth table50%1/2
A
A= delete $values{'rel'}
Aresult
11
00
297 6 return $self->add(link => {
298 rel => $rel,
299 %values
300 });
301 };
302  
303 8 my $rel = shift;
304  
305 8 my $children;
306 # Node is root
307 8 ▶ unless ($self->parent) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->parent) { } 3 5 8
308 5 $children = $self->at('*')->children('link');
309 }
310  
311 # Node is under root
312 else {
313 3 $children = $self->children('link');
314 };
315  
316 8 ▶ return $children->grep(sub { $_->attr('rel') eq $rel });
Subroutine __ANON__: called CC=1 SCAR=0.0
317 };
318  
319  
320 # Add logo
321 3 ▶sub logo {
Subroutine logo: called CC=1 SCAR=0.0
Pod documented
322 3 shift->_simple_feed_info(logo => @_);
323 };
324  
325  
326 # Add publish time information
327 14 ▶sub published {
Subroutine published: called CC=1 SCAR=0.0
Pod documented
328 14 shift->_date(published => @_);
329 };
330  
331  
332 # Add rights information
333 3 ▶sub rights {
Subroutine rights: called CC=2 SCAR=6.9
Pod documented
334 3 my $self = shift;
335  
336 # Set rights
337 3 ▶ return $self->_addset_text(set => rights => @_) if $_[0];
Branch: 1 branch
BranchTrueFalseTotal
if $_[0] 2 1 3
338  
339 # Return rights
340 1 return $self->_get_information_single('rights');
341 };
342  
343  
344 # Add source information to entry
345 3 ▶sub source {
Subroutine source: called CC=4 SCAR=14.6
Pod documented
346 3 my $self = shift;
347  
348 # Only valid in entry
349 3 ▶ return if !$self->tag || $self->tag ne 'entry';
Branch: 1 branch
BranchTrueFalseTotal
if not $self->tag or $self->tag ne "entry" 0 3 3
Condition33%1/3
not $self->tag or $self->tag ne "entry"
l!l&&r!l&&!r
003
MC/DC0%0/2
not $self->tag or $self->tag ne "entry"
not $self->tag $self->tag ne "entry"
Truth table33%1/3
not(A) or B
A= not $self->tagB= $self->tag ne "entry"
ABresult
1X1
011
000
350  
351 # Set source
352 3 ▶ return $self->set(source => @_) if $_[0];
Branch: 1 branch
BranchTrueFalseTotal
if $_[0] 1 2 3
353  
354 # Return source
355 2 return $self->_get_information_single('source');
356 };
357  
358  
359 # Add subtitle
360 10 ▶sub subtitle {
Subroutine subtitle: called CC=4 SCAR=13.9
Pod documented
361 10 my $self = shift;
362  
363 # Only valid in feed or source or something
364 10 ▶ return if $self->tag && $self->tag eq 'entry';
Branch: 1 branch
BranchTrueFalseTotal
if $self->tag and $self->tag eq "entry" 1 9 10
Condition66%2/3
$self->tag and $self->tag eq "entry"
!ll&&!rl&&r
901
MC/DC50%1/2
$self->tag and $self->tag eq "entry"
$self->tag $self->tag eq "entry"
Truth table66%2/3
A and B
A= $self->tagB= $self->tag eq "entry"
ABresult
0X0
100
111
365  
366 # Set subtitle
367 9 ▶ return $self->_addset_text(set => subtitle => @_) if $_[0];
Branch: 1 branch
BranchTrueFalseTotal
if $_[0] 6 3 9
368  
369 # Return subtitle
370 3 return $self->_get_information_single('subtitle');
371 };
372  
373  
374 # Add summary
375 12 ▶sub summary {
Subroutine summary: called CC=4 SCAR=13.9
Pod documented
376 12 my $self = shift;
377  
378 # Only valid in entry
379 12 ▶ return if !$self->tag || $self->tag ne 'entry';
Branch: 1 branch
BranchTrueFalseTotal
if not $self->tag or $self->tag ne "entry" 1 11 12
Condition66%2/3
not $self->tag or $self->tag ne "entry"
l!l&&r!l&&!r
1011
MC/DC50%1/2
not $self->tag or $self->tag ne "entry"
not $self->tag $self->tag ne "entry"
Truth table66%2/3
not(A) or B
A= not $self->tagB= $self->tag ne "entry"
ABresult
1X1
011
000
380  
381 # Set summary
382 11 ▶ return $self->_addset_text(set => summary => @_) if $_[0];
Branch: 1 branch
BranchTrueFalseTotal
if $_[0] 6 5 11
383  
384 # Return summary
385 5 return $self->_get_information_single('summary');
386 };
387  
388  
389 # Add title
390 15 ▶sub title {
Subroutine title: called CC=2 SCAR=6.9
Pod documented
391 15 my $self = shift;
392  
393 # Set title
394 15 ▶ return $self->_addset_text(set => title => @_) if $_[0];
Branch: 1 branch
BranchTrueFalseTotal
if $_[0] 9 6 15
395  
396 # Return title
397 6 return $self->_get_information_single('title');
398 };
399  
400  
401 # Add update time information
402 7 ▶sub updated {
Subroutine updated: called CC=1 SCAR=0.0
Pod documented
403 7 shift->_date(updated => @_);
404 };
405  
406  
407 # Add person information
408 17 ▶sub _add_person {
Subroutine _add_person: called CC=4 SCAR=13.9
409 17 my $self = shift;
410 17 my $type = shift;
411  
412 # Person is a defined node
413 17 ▶ if (ref($_[0])) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[0]) { } 3 14 17
414 3 my $person = shift;
415 3 $person->root->at('*')->tree->[1] = $type;
416 3 return $self->add($person);
417 }
418  
419 # Person is a hash
420 else {
421 14 my $person = $self->add($type);
422 14 my %data = @_;
423  
424 14 foreach (keys %data) {
425 15 ▶ $person->add($_ => $data{$_} ) if $data{$_};
Branch: 1 branch
BranchTrueFalseTotal
if $data{$_} 15 0 15
426 };
427 14 return $person;
428 };
429 };
430  
431  
432 # Add date construct
433 21 ▶sub _date {
Subroutine _date: called CC=4 SCAR=14.1
434 21 my $self = shift;
435 21 my $type = shift;
436  
437 # Set date
438 21 ▶ if ($_[0]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]) 9 12 21
439 9 my $date = shift;
440  
441 9 ▶ unless (ref($date)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $date) 9 0 9
442 9 $date = XML::Loy::Date::RFC3339->new($date);
443 };
444  
445 9 return $self->set($type, $date->to_string);
446 };
447  
448 # Get published information
449 12 my $date = $self->_get_information_single($type);
450  
451 # Parse date
452 12 ▶ return XML::Loy::Date::RFC3339->new($date->text) if $date;
Branch: 1 branch
BranchTrueFalseTotal
if $date 12 0 12
453  
454 # No publish information found
455 0 return;
456 };
457  
458  
459 # Add text information
460 73 ▶sub _addset_text {
Subroutine _addset_text: called CC=10 SCAR=23.5
461 73 my $self = shift;
462 73 my $action = shift;
463  
464 73 ▶ unless ($action eq 'add' || $action eq 'set') {
Branch: 1 branch
BranchTrueFalseTotal
unless ($action eq "add" or $action eq "set") 0 73 73
Condition33%1/3
$action eq "add" or $action eq "set"
l!l&&r!l&&!r
0730
MC/DC0%0/2
$action eq "add" or $action eq "set"
$action eq "add" $action eq "set"
Truth table33%1/3
A or B
A= $action eq "add"B= $action eq "set"
ABresult
1X1
011
000
465 0 ▶ warn 'Action has to be set or add' and return;
Branch: 1 branch
BranchTrueFalseTotal
warn "Action has to be set or add" and return 0 0 0
466 };
467  
468 73 my $type = shift;
469  
470 # Text is a defined node
471 73 ▶ if (ref $_[0]) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[0]) 37 36 73
472  
473 37 my $text = shift;
474  
475 # Get root element
476 37 my $root_elem = $text->root->at('*');
477  
478 37 $root_elem->tree->[1] = $type;
479 37 my $root_att = $root_elem->attr;
480  
481 # Delete type
482 37 ▶ my $c_type = $root_att->{type} || '';
Condition50%1/2
$root_att->{'type'} || ''
l!l
370
MC/DC0%0/1
$root_att->{'type'} || ''
$root_att->{'type'}
Truth table50%1/2
A
A= $root_att->{'type'}
Aresult
11
00
483 37 ▶ if ($c_type eq 'text') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c_type eq "text") 16 21 37
484 16 delete $root_elem->attr->{'type'};
485 };
486  
487 37 $text->root->at('*')->tree->[1] = $type;
488  
489 37 my $element = $self->$action($text);
490  
491 # Return wrapped div
492 37 ▶ return $element->at('div') if $c_type eq 'xhtml';
Branch: 1 branch
BranchTrueFalseTotal
if $c_type eq "xhtml" 9 28 37
493  
494 # Return node
495 28 return $element;
496 };
497  
498 36 my $text;
499 # Text is no hash
500 36 ▶ unless (defined $_[1]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[1]) { } 24 12 36
501 12 $text = $self->new_text(
502 type => 'text',
503 content => shift
504 );
505 }
506  
507 # Text is a hash
508 else {
509 24 $text = $self->new_text(@_);
510 };
511  
512 # Todo: Optimize!
513 36 ▶ return $self->_addset_text($action, $type, $text) if ref $text;
Branch: 1 branch
BranchTrueFalseTotal
if ref $text 35 1 36
514 1 return;
515 };
516  
517  
518 # Return information of entries or the feed
519 17 ▶sub _get_information_array {
Subroutine _get_information_array: called CC=2 SCAR=7.4
520 17 my $self = shift;
521 17 my $type = shift;
522  
523 # Get author objects
524 17 my $children = $self->children($type);
525  
526 # Return information of object
527 17 ▶ return $children if $children->[0];
Branch: 1 branch
BranchTrueFalseTotal
if $children->[0] 17 0 17
528  
529 # Return feed information
530 0 return $self->find('feed > ' . $type);
531 };
532  
533  
534 # Return information of entries or the feed
535 34 ▶sub _get_information_single {
Subroutine _get_information_single: called CC=2 SCAR=7.4
536 34 my $self = shift;
537 34 my $type = shift;
538  
539 # Get author objects
540 34 my $children = $self->children($type);
541  
542 # Return information of object
543 34 ▶ return $children->[0] if $children->[0];
Branch: 1 branch
BranchTrueFalseTotal
if $children->[0] 34 0 34
544  
545 # Return feed information
546 0 return $self->at('feed > ' . $type);
547 };
548  
549  
550 # Get or set simple feed information
551 # like generator or icon
552 10 ▶sub _simple_feed_info {
Subroutine _simple_feed_info: called CC=4 SCAR=14.0
553 10 my $self = shift;
554 10 my $type = shift;
555  
556 10 my $feed = $self->root->at('feed');
557 10 ▶ return unless $feed;
Branch: 1 branch
BranchTrueFalseTotal
unless $feed 3 7 10
558  
559 # Set
560 7 ▶ if ($_[0]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]) 6 1 7
561 6 return $feed->set($type => @_);
562 };
563  
564 # Get generator information
565 1 my $gen = $feed->at($type);
566 1 ▶ return $gen->all_text if $gen;
Branch: 1 branch
BranchTrueFalseTotal
if $gen 1 0 1
567 0 return;
568 };
569  
570  
571 9 1;
572  
573  
574 __END__
« lib/XML/Loy/GeoRSS.pm ↑ Summary blib/lib/XML/Loy/Atom/Threading.pm »