Config::Any::General - Load Config::General files


Config-Any documentation Contained in the Config-Any distribution.

Index


Code Index:

NAME

Top

Config::Any::General - Load Config::General files

DESCRIPTION

Top

Loads Config::General files. Example:

    name = TestApp
    <Component Controller::Foo>
        foo bar
        bar [ arrayref-value ]
    </Component>
    <Model Baz>
        qux xyzzy
    </Model>

METHODS

Top

extensions( )

return an array of valid extensions (cnf, conf).

load( $file )

Attempts to load $file via Config::General.

requires_all_of( )

Specifies that this module requires Config::General in order to work.

AUTHOR

Top

Brian Cassidy <bricas@cpan.org>

CONTRIBUTORS

Top

Joel Bernstein <rataxis@cpan.org>

COPYRIGHT AND LICENSE

Top

SEE ALSO

Top

* Catalyst
* Config::Any
* Config::General

Config-Any documentation Contained in the Config-Any distribution.
package Config::Any::General;

use strict;
use warnings;

use base 'Config::Any::Base';

sub extensions {
    return qw( cnf conf );
}

sub load {
    my $class = shift;
    my $file  = shift;
    my $args  = shift || {};

    $args->{ -ConfigFile } = $file;

    require Config::General;
    Config::General->VERSION( '2.47' );

    $args->{ -ForceArray } = 1 unless exists $args->{ -ForceArray };

    my $configfile = Config::General->new( %$args );
    my $config     = { $configfile->getall };

    return $config;
}

sub requires_all_of { [ 'Config::General' ] }

1;