blib/lib/XML/Catalogs.pm

filter: Statementstmt 41.1% 14 / 34 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 4 / 8 Podpod 100% 3 / 3 totaltotal 42.8% 21 / 49 CC 4 SCAR 16.3
CC
4
Cov
37%
import
12.0
get_catalog_path
6.0
get_catalog_url
2.0
CRAP 5.1
↑ Summary
1  
2 package XML::Catalogs;
3  
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use version; our $VERSION = qv('v1.6.0');
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9  
10 1 ▶use File::ShareDir qw( );
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12  
13 0 ▶sub import {
Subroutine import: not called CC=3 SCAR=24.8
14 0 my $class = shift;
15 0 for ( @_ ) {
16 0 ▶ if ( $_ eq -libxml ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ eq '-libxml') { } 0 0 0
17 0 $class->notify_libxml()
18 } else {
19 0 require Carp;
20 0 Carp::croak( "Unrecognized import $_" );
21 }
22 }
23 }
24  
25  
26 0 ▶sub get_catalog_path {
Subroutine get_catalog_path: not called CC=2 SCAR=17.9
Pod documented
27 0 my $class = shift;
28  
29 0 my $path = eval { File::ShareDir::module_file( $class, 'catalog.xml' ) };
30 0 ▶ if ( !defined( $path ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $path) 0 0 0
31 0 require Carp;
32 0 Carp::croak( "Can't locate ${class}'s catalog" );
33 }
34  
35 0 return $path;
36 }
37  
38  
39 0 ▶sub get_catalog_url {
Subroutine get_catalog_url: not called CC=1 SCAR=6.9
Pod documented
40 0 my $class = shift;
41 0 require URI::file;
42 0 return URI::file->new( $class->get_catalog_path() );
43 }
44  
45  
46 0 ▶sub notify_libxml {
Subroutine notify_libxml: not called CC=1 SCAR=6.9
Pod documented
47 0 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 1;
57  
58 __END__
↑ Summary