File Coverage

lib/Geo/ISO19139.pm
Criterion Covered Total %
statement 13 15 86.6
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 18 20 90.0


line stmt bran cond sub pod time code
1             # Copyrights 2008 by Mark Overmeer.
2             # For other contributors see ChangeLog.
3             # See the manual pages for details on the licensing terms.
4             # Pod stripped from pm file by OODoc 1.05.
5 2     2   32347 use warnings;
  2         4  
  2         58  
6 2     2   11 use strict;
  2         2  
  2         79  
7              
8             package Geo::ISO19139;
9 2     2   10 use vars '$VERSION';
  2         3  
  2         120  
10             $VERSION = '0.10';
11              
12              
13 2     2   1767 use Log::Report 'geo-iso', syntax => 'SHORT';
  2         234642  
  2         14  
14 2     2   2785 use XML::Compile::Cache ();
  0            
  0            
15             use XML::Compile::Util qw/unpack_type pack_type/;
16              
17             my %version2pkg =
18             ( 2005 => 'Geo::ISO19139::2005'
19             );
20              
21              
22             sub new(@)
23             { my $class = shift;
24             my ($direction, %args) = @_;
25              
26             # having a default here cannot be maintained over the years.
27             my $version = delete $args{version}
28             or error __x"an explicit version is required\n";
29              
30             my $pkg = $version2pkg{$version}
31             or error __x"no implementation for version '{version}'"
32             , version => $version;
33              
34             eval "require $pkg";
35             $@ and die $@;
36              
37             $pkg->new($direction, %args);
38             }
39              
40             1;