File Coverage

blib/lib/Colon/Config.pm
Criterion Covered Total %
statement 14 17 82.3
branch 3 4 75.0
condition n/a
subroutine 4 5 80.0
pod 1 2 50.0
total 22 28 78.5


line stmt bran cond sub pod time code
1             # Copyright (c) 2018, cPanel, LLC.
2             # All rights reserved.
3             # http://cpanel.net
4             #
5             # This is free software; you can redistribute it and/or modify it under the
6             # same terms as Perl itself. See L.
7              
8             package Colon::Config;
9              
10 7     7   1245070 use strict;
  7         49  
  7         188  
11 7     7   37 use warnings;
  7         13  
  7         351  
12              
13             # ABSTRACT: XS helper to read a configuration file using ':' as separator
14              
15              
16             BEGIN {
17              
18 7     7   24 our $VERSION = '0.004'; # VERSION: generated by DZP::OurPkgVersion
19              
20 7         29 require XSLoader;
21 7         4723 XSLoader::load(__PACKAGE__);
22             }
23              
24             sub read_pp {
25 0     0 0 0 my ( $config ) = @_;
26              
27 0         0 return [ map { ( split( m{:\s+}, $_ ) )[ 0, 1 ] } split( m{\n}, $config ) ];
  0         0  
28             }
29              
30             sub read_as_hash {
31 16     16 1 54478 my ( $config, $field ) = @_;
32              
33 16 100       53 $field = 0 unless defined $field;
34              
35 16         209 my $av = Colon::Config::read($config, $field );
36 16 50       44 return {} unless $av;
37              
38 16         168 return { @$av };
39             }
40              
41              
42             1;
43              
44             __END__