File Coverage

blib/lib/XML/Atom/Syndication/Util.pm
Criterion Covered Total %
statement 18 18 100.0
branch 3 4 75.0
condition 1 3 33.3
subroutine 5 5 100.0
pod 0 2 0.0
total 27 32 84.3


line stmt bran cond sub pod time code
1             package XML::Atom::Syndication::Util;
2 22     22   122 use strict;
  22         39  
  22         1106  
3              
4 22     22   127 use vars qw( @EXPORT_OK );
  22         111  
  22         1319  
5             @EXPORT_OK = qw( utf8_off nodelist );
6              
7 22     22   118 use base qw( Exporter );
  22         36  
  22         7331  
8              
9             sub utf8_off {
10 111 50 33 111 0 1453 if ($] > 5.008 && defined $_[0]) {
11 111         1772 require Encode;
12 111         13314 Encode::_utf8_off($_[0]);
13             }
14 111         669 $_[0];
15             }
16              
17             sub nodelist {
18 234     234 0 472 my ($node, $ns, $name) = @_;
19 808 100       7418 my @nodes =
20 234         1172 grep { ref($_) eq 'XML::Elemental::Element' && $_->name eq "{$ns}$name" }
21 234         374 @{$node->elem->contents};
22 234         1641 @nodes;
23             }
24              
25             1;