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