X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FConfig-Any.git;a=blobdiff_plain;f=lib%2FConfig%2FAny%2FINI.pm;fp=lib%2FConfig%2FAny%2FINI.pm;h=092362dec3881d31221d5fd1408fe90e3e5a009a;hp=0000000000000000000000000000000000000000;hb=c80a0905834ed09d487b84d7a00a3e92e44bbb62;hpb=221baba75d0a2decf1f4f4ff3e4b1ba0f64b2f71 diff --git a/lib/Config/Any/INI.pm b/lib/Config/Any/INI.pm new file mode 100644 index 0000000..092362d --- /dev/null +++ b/lib/Config/Any/INI.pm @@ -0,0 +1,82 @@ +package Config::Any::INI; + +use strict; +use warnings; + +=head1 NAME + +Config::Any::INI - Load INI config files + +=head1 DESCRIPTION + +Loads INI files. Example: + + name=TestApp + + [Controller::Foo] + foo=bar + + [Model::Baz] + qux=xyzzy + +=head1 METHODS + +=head2 extensions( ) + +return an array of valid extensions (C). + +=cut + +sub extensions { + return qw( ini ); +} + +=head2 load( $file ) + +Attempts to load C<$file> as an INI file. + +=cut + +sub load { + my $class = shift; + my $file = shift; + + require Config::Tiny; + my $config = Config::Tiny->read( $file ); + my $main = delete $config->{ _ }; + + $config->{ $_ } = $main->{ $_ } for keys %$main; + + return $config; +} + +=head1 AUTHOR + +=over 4 + +=item * Brian Cassidy Ebricas@cpan.orgE + +=back + +=head1 COPYRIGHT AND LICENSE + +Copyright 2006 by Brian Cassidy + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=head1 SEE ALSO + +=over 4 + +=item * L + +=item * L + +=item * L + +=back + +=cut + +1; \ No newline at end of file