1 package Config::Any::General;
8 Config::Any::General - Load Config::General files
12 Loads Config::General files. Example:
15 <Component Controller::Foo>
26 return an array of valid extensions (C<cnf>, C<conf>).
31 return qw( cnf conf );
36 Attempts to load C<$file> via Config::General.
43 my $args = shift || {};
45 # work around bug (?) in Config::General
46 # return if $class->_test_perl($file);
48 $args->{-ConfigFile} = $file;
50 require Config::General;
51 my $configfile = Config::General->new( %$args );
52 my $config = { $configfile->getall };
57 # this is a bit of a hack but necessary, because Config::General is *far* too lax
58 # about what it will load -- specifically, it seems to be quite happy to load a Perl
59 # config file (ie, a file which is valid Perl and creates a hashref) as if it were
60 # an Apache-style configuration file, presumably due to laziness on the part of the
64 my ($class, $file) = @_;
66 eval { $is_perl_src = do "$file"; };
67 delete $INC{$file}; # so we don't screw stuff later on
68 return defined $is_perl_src;
75 =item * Brian Cassidy E<lt>bricas@cpan.orgE<gt>
83 =item * Joel Bernstein C<< <rataxis@cpan.org> >>
87 =head1 COPYRIGHT AND LICENSE
89 Copyright 2006 by Brian Cassidy
91 Portions Copyright 2006 Portugal Telecom
93 This library is free software; you can redistribute it and/or modify
94 it under the same terms as Perl itself.
102 =item * L<Config::Any>
104 =item * L<Config::General>