use warnings; use strict; package Config::Singleton 0.006; # ABSTRACT: one place for your app's configuration use Cwd (); use File::Basename (); use File::HomeDir (); use File::Spec (); use YAML::XS (); use Sub::Exporter -setup => { groups => [ setup => \'_build_config_methods' ], }; #pod =head1 SYNOPSIS #pod #pod package YourApplication::Config; #pod #pod use Config::Singleton -setup => { #pod filename => 'something.yaml', #pod template => { #pod foo => undef, #pod bar => 1024, #pod qux => [ 1, 2, 3], #pod }, #pod }; #pod #pod Elsewhere... #pod #pod use YourApplication::Config 'my_instance_config.yml'; #pod #pod my $foo = YourApplication::Config->foo; #pod #pod =head1 DESCRIPTION #pod #pod Config::Singleton provides a base class for access to configuration data for #pod your app. The basic implementation stores its configuration in YAML in a text #pod file found in all the usual places. By default, Config::Singleton looks for #pod myapp.yml, but an alternate filename may be passed when using the module. #pod #pod This module was derived from L. #pod #pod =head1 USING APP::CONFIG #pod #pod The L section, above, demonstrates an example of almost every #pod feature of Config::Singleton It's a very simple module with a very small #pod interface. #pod #pod It is not a base class. It is a utility for setting up a class that stores #pod loaded configuration data. You just need to C the module like this: #pod #pod package Your::Config; #pod #pod use Config::Singleton -setup => { #pod filename => 'your_program.yaml', #pod template => { #pod username => undef, #pod hostname => undef, #pod logfile => undef, #pod facility => 'local1', #pod path => [ qw(/var/spool /tmp/jobs) ], #pod }, #pod }; #pod #pod When another module uses Your::Config, F will be loaded and #pod its contents will be merged over the defaults given by the C