File Coverage

lib/XML/FeedWriter.pm
Criterion Covered Total %
statement 9 15 60.0
branch 0 4 0.0
condition 0 2 0.0
subroutine 3 4 75.0
pod 1 1 100.0
total 13 26 50.0


line stmt bran cond sub pod time code
1             package XML::FeedWriter;
2            
3 1     1   50310 use strict;
  1         2  
  1         59  
4 1     1   6 use warnings;
  1         3  
  1         38  
5 1     1   6 use Carp;
  1         6  
  1         268  
6            
7             our $VERSION = '0.06';
8            
9             my %supported = (
10             'RSS20' => 'RSS20',
11             'RSS 2.0' => 'RSS20',
12             '2.0' => 'RSS20',
13             2 => 'RSS20', # in case version specified as a number
14             );
15            
16             sub new {
17 0     0 1   my ($class, %options) = @_;
18            
19 0   0       my $version = delete $options{version} || '2.0';
20            
21 0 0         croak "not yet supported: $version" unless $supported{$version};
22            
23 0           my $package = __PACKAGE__.'::'.$supported{$version};
24 0 0         eval "require $package;" or die $@;
25            
26 0           $package->new(%options);
27             }
28            
29             1;
30            
31             __END__