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 21     21   73 use strict;
  21         20  
  21         545  
3              
4 21     21   62 use vars qw( @EXPORT_OK );
  21         20  
  21         834  
5             @EXPORT_OK = qw( utf8_off nodelist );
6              
7 21     21   77 use base qw( Exporter );
  21         16  
  21         4260  
8              
9             sub utf8_off {
10 111 50 33 111 0 1040 if ($] > 5.008 && defined $_[0]) {
11 111         1354 require Encode;
12 111         10862 Encode::_utf8_off($_[0]);
13             }
14 111         392 $_[0];
15             }
16              
17             sub nodelist {
18 228     228 0 284 my ($node, $ns, $name) = @_;
19             my @nodes =
20 794 100       4383 grep { ref($_) eq 'XML::Elemental::Element' && $_->name eq "{$ns}$name" }
21 228         241 @{$node->elem->contents};
  228         566  
22 228         948 @nodes;
23             }
24              
25             1;