File Coverage

blib/lib/Colon/Config.pm
Criterion Covered Total %
statement 13 16 81.2
branch 1 2 50.0
condition n/a
subroutine 4 5 80.0
pod 1 2 50.0
total 19 25 76.0


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 3     3   449968 use strict;
  3         19  
  3         84  
11 3     3   15 use warnings;
  3         5  
  3         156  
12              
13             # ABSTRACT: XS helper to read a configuration file using ':' as separator
14              
15              
16             BEGIN {
17              
18 3     3   11 our $VERSION = '0.002'; # VERSION: generated by DZP::OurPkgVersion
19              
20 3         12 require XSLoader;
21 3         1875 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 1     1 1 17172 my ( $config ) = @_;
32              
33 1         6 my $av = Colon::Config::read($config);
34 1 50       4 return unless $av;
35              
36 1         8 return { @$av };
37             }
38              
39              
40             1;
41              
42             __END__