Config-Micro

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN


# SYNOPSIS

    package Your::App::Class;
    use Config::Micro;
    use File::Spec;
    

    my $conf_dir  = File::Spec->catdir(qw/.. etc/);
    my $conf_file = Config::Micro->file( env => 'development', dir => $conf_dir );
    my $config = require( $conf_file );
    ...

# SUBROUTINES/METHODS

## file

Return a path of config file that matches for application environment.

You may specify following options.

lib/Config/Micro.pm  view on Meta::CPAN



=head1 SYNOPSIS

    package Your::App::Class;
    use Config::Micro;
    use File::Spec;
    
    my $conf_dir  = File::Spec->catdir(qw/.. etc/);
    my $conf_file = Config::Micro->file( env => 'development', dir => $conf_dir );
    my $config = require( $conf_file );
    ...

=head1 SUBROUTINES/METHODS

=head2 file

Return a path of config file that matches for application environment.

You may specify following options.

t/TestApp/lib/TestApp.pm  view on Meta::CPAN

package TestApp;
use strict;
use warnings;
use Config::Micro;

sub new {
    my ($class, %opts) = @_;
    my $conf_file = Config::Micro->file(%opts);
    my $conf = require "$conf_file";
    return bless +{ config => $conf }, $class;
}

sub foo {
    my $self = shift;
    return $self->{config}{env};
}

1;



( run in 0.412 second using v1.01-cache-2.11-cpan-0d8aa00de5b )