File Coverage

blib/lib/XML/Catalogs.pm
Criterion Covered Total %
statement 12 32 37.5
branch 0 4 0.0
condition n/a
subroutine 4 8 50.0
pod 3 3 100.0
total 19 47 40.4


line stmt bran cond sub pod time code
1              
2             package XML::Catalogs;
3              
4 1     1   140674 use strict;
  1         2  
  1         65  
5 1     1   7 use warnings;
  1         2  
  1         79  
6              
7 1     1   519 use version; our $VERSION = qv('v1.6.0');
  1         2490  
  1         7  
8              
9              
10 1     1   802 use File::ShareDir qw( );
  1         41043  
  1         290  
11              
12              
13             sub import {
14 0     0     my $class = shift;
15 0           for ( @_ ) {
16 0 0         if ( $_ eq -libxml ) {
17 0           $class->notify_libxml()
18             } else {
19 0           require Carp;
20 0           Carp::croak( "Unrecognized import $_" );
21             }
22             }
23             }
24              
25              
26             sub get_catalog_path {
27 0     0 1   my $class = shift;
28              
29 0           my $path = eval { File::ShareDir::module_file( $class, 'catalog.xml' ) };
  0            
30 0 0         if ( !defined( $path ) ) {
31 0           require Carp;
32 0           Carp::croak( "Can't locate ${class}'s catalog" );
33             }
34              
35 0           return $path;
36             }
37              
38              
39             sub get_catalog_url {
40 0     0 1   my $class = shift;
41 0           require URI::file;
42 0           return URI::file->new( $class->get_catalog_path() );
43             }
44              
45              
46             sub notify_libxml {
47 0     0 1   my $class = shift;
48 0           require XML::LibXML;
49 0           XML::LibXML->VERSION( 1.53 );
50 0           XML::LibXML->load_catalog(
51             $class->get_catalog_path()
52             );
53             }
54              
55              
56             1;
57              
58             __END__