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