1 package Config::Any::General;
6 use base 'Config::Any::Base';
10 Config::Any::General - Load Config::General files
14 Loads Config::General files. Example:
17 <Component Controller::Foo>
28 return an array of valid extensions (C<cnf>, C<conf>).
33 return qw( cnf conf );
38 Attempts to load C<$file> via Config::General.
45 my $args = shift || {};
47 # work around bug (?) in Config::General
48 # return if $class->_test_perl($file);
50 $args->{ -ConfigFile } = $file;
52 require Config::General;
53 my $configfile = Config::General->new( %$args );
54 my $config = { $configfile->getall };
59 # this is a bit of a hack but necessary, because Config::General is *far* too lax
60 # about what it will load -- specifically, it seems to be quite happy to load a Perl
61 # config file (ie, a file which is valid Perl and creates a hashref) as if it were
62 # an Apache-style configuration file, presumably due to laziness on the part of the
66 my ( $class, $file ) = @_;
68 eval { $is_perl_src = do "$file"; };
69 delete $INC{ $file }; # so we don't screw stuff later on
70 return defined $is_perl_src;
73 =head2 requires_all_of( )
75 Specifies that this module requires L<Config::General> in order to work.
79 sub requires_all_of { 'Config::General' }
83 Brian Cassidy E<lt>bricas@cpan.orgE<gt>
87 Joel Bernstein C<< <rataxis@cpan.org> >>
89 =head1 COPYRIGHT AND LICENSE
91 Copyright 2006-2009 by Brian Cassidy
93 Portions Copyright 2006 Portugal Telecom
95 This library is free software; you can redistribute it and/or modify
96 it under the same terms as Perl itself.
104 =item * L<Config::Any>
106 =item * L<Config::General>