1 package Config::Any::INI;
\r
6 our $MAP_SECTION_SPACE_TO_NESTED_KEY = 1;
\r
10 Config::Any::INI - Load INI config files
\r
14 Loads INI files. Example:
\r
26 =head2 extensions( )
\r
28 return an array of valid extensions (C<ini>).
\r
36 =head2 load( $file )
\r
38 Attempts to load C<$file> as an INI file.
\r
46 require Config::Tiny;
\r
47 my $config = Config::Tiny->read( $file );
\r
49 my $main = delete $config->{ _ };
\r
51 $out->{$_} = $main->{$_} for keys %$main;
\r
53 for my $k (keys %$config) {
\r
54 my @keys = split /\s+/, $k if $MAP_SECTION_SPACE_TO_NESTED_KEY;
\r
55 my $ref = $config->{$k};
\r
58 my ($a, $b) = @keys[0,1];
\r
59 $out->{$a}->{$b} = $ref;
\r
67 =head1 PACKAGE VARIABLES
\r
71 =item $MAP_SECTION_SPACE_TO_NESTED_KEY (boolean)
\r
73 This variable controls whether spaces in INI section headings will be expanded into nested hash keys.
\r
74 e.g. it controls whether [Full Power] maps to $config->{'Full Power'} or $config->{'Full'}->{'Power'}
\r
76 By default it is set to 1 (i.e. true).
\r
78 Set it to 0 to preserve literal spaces in section headings:
\r
81 use Config::Any::INI;
\r
82 $Config::Any::INI::MAP_SECTION_SPACE_TO_NESTED_KEY = 0;
\r
90 =item * Brian Cassidy E<lt>bricas@cpan.orgE<gt>
\r
92 =item * Joel Bernstein E<lt>rataxis@cpan.orgE<gt>
\r
96 =head1 COPYRIGHT AND LICENSE
\r
98 Copyright 2006 by Brian Cassidy, portions copyright 2006, 2007 by Joel Bernstein
\r
100 This library is free software; you can redistribute it and/or modify
\r
101 it under the same terms as Perl itself.
\r
107 =item * L<Catalyst>
\r
109 =item * L<Config::Any>
\r
111 =item * L<Config::Tiny>
\r