blib/lib/XML/Loy/Atom.pm

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