File Coverage

blib/lib/Template/Plugin/RSSLite.pm
Criterion Covered Total %
statement 28 28 100.0
branch 2 4 50.0
condition 1 2 50.0
subroutine 7 7 100.0
pod 1 1 100.0
total 39 42 92.8


line stmt bran cond sub pod time code
1             package Template::Plugin::RSSLite;
2              
3 1     1   528 use 5.006;
  1         3  
  1         49  
4 1     1   6 use strict;
  1         1  
  1         35  
5 1     1   6 use warnings;
  1         1  
  1         39  
6 1     1   5 use base qw( Template::Plugin );
  1         1  
  1         717  
7 1     1   657 use Template::Plugin;
  1         1  
  1         20  
8 1     1   683 use XML::RSSLite;
  1         2110  
  1         6  
9              
10             our $VERSION = '0.03';
11              
12             sub new {
13 1     1 1 33 my $class = shift;
14 1         2 my $context = shift;
15 1   50     3 my $file = shift || return $class->error("Line ".__LINE__." Usage error, see documenatation for usage information.");
16 1         2 my $result = {};
17 1 50       35 open F, $file or return $class->error("Line ".__LINE__." ".$!);
18 1         43 my $data = join("",());
19 1         12 close F;
20 1         3 XML::RSSLite::parseXML($result,\$data);
21             # use Data::Dumper;print Dumper $result;
22 1 50       2347 return $class->error("Line ".__LINE__." ".$!) unless ($result->{'rdf:RDF'}{'channel'}{'title'});
23 1         6 bless $result, $class;
24             }
25              
26             1;
27             __END__