File Coverage

blib/lib/Config/Any/General.pm
Criterion Covered Total %
statement 11 21 52.3
branch 0 2 0.0
condition 0 2 0.0
subroutine 5 6 83.3
pod 3 3 100.0
total 19 34 55.8


line stmt bran cond sub pod time code
1             package Config::Any::General;
2              
3 6     6   6462 use strict;
  6         29  
  6         177  
4 6     6   35 use warnings;
  6         10  
  6         174  
5              
6 6     6   34 use base 'Config::Any::Base';
  6         11  
  6         2096  
7              
8             =head1 NAME
9              
10             Config::Any::General - Load Config::General files
11              
12             =head1 DESCRIPTION
13              
14             Loads Config::General files. Example:
15              
16             name = TestApp
17            
18             foo bar
19             bar [ arrayref-value ]
20            
21            
22             qux xyzzy
23            
24              
25             =head1 METHODS
26              
27             =head2 extensions( )
28              
29             return an array of valid extensions (C, C).
30              
31             =cut
32              
33             sub extensions {
34 10     10 1 52 return qw( cnf conf );
35             }
36              
37             =head2 load( $file )
38              
39             Attempts to load C<$file> via Config::General.
40              
41             =cut
42              
43             sub load {
44 0     0 1 0 my $class = shift;
45 0         0 my $file = shift;
46 0   0     0 my $args = shift || {};
47              
48 0         0 $args->{ -ConfigFile } = $file;
49              
50 0         0 require Config::General;
51 0         0 Config::General->VERSION( '2.48' );
52              
53 0 0       0 $args->{ -ForceArray } = 1 unless exists $args->{ -ForceArray };
54              
55 0         0 my $configfile = Config::General->new( %$args );
56 0         0 my $config = { $configfile->getall };
57              
58 0         0 return $config;
59             }
60              
61             =head2 requires_all_of( )
62              
63             Specifies that this module requires L in order to work.
64              
65             =cut
66              
67 4     4 1 20 sub requires_all_of { [ 'Config::General' => '2.48' ] }
68              
69             =head1 AUTHOR
70              
71             Brian Cassidy
72              
73             =head1 CONTRIBUTORS
74              
75             Joel Bernstein
76              
77             =head1 COPYRIGHT AND LICENSE
78              
79             Copyright 2006-2016 by Brian Cassidy
80              
81             Portions Copyright 2006 Portugal Telecom
82              
83             This library is free software; you can redistribute it and/or modify
84             it under the same terms as Perl itself.
85              
86             =head1 SEE ALSO
87              
88             =over 4
89              
90             =item * L
91              
92             =item * L
93              
94             =item * L
95              
96             =back
97              
98             =cut
99              
100             1;