NAME
Config::PlConfig - Maintain a single place for configuration files.
VERSION
This document describes Config::PlConfig version 0.1_02
SYNOPSIS
use Config::PlConfig;
# User configuration.
my $plconfig_userconfig = Config::PlConfig->new({
host => 'local',
domain => 'com.mycorp.myapp',
});
my $config = $plconfig_userconfig->load();
$config->{database}{driver} = 'mysql';
$config->save();
# Global configuration.
my $plconfig_globalconfig = Config::PlConfig->new({
host => 'global',
domain => 'com.mycorp.myapp',
});
$config->{mycorp_homepage} = 'http://foo.com';
$config->save;
DESCRIPTION
This is a prototype for a configuration system in Perl. It is meant to be inspired by the gconf and Apple Property List configuration systems.
The name, API and features of this module is most likely to change in the near future so it's not meant to be used for production systems.
If you'd like to help develop a configuration system for Perl, you are very welcome.
WHERE DOES IT SAVE CONFIGURATION FILES?
LOCAL CONFIGURATION
Local configuration files will be stored in the data directory of the users home directory.
File::HomeDirs my_data
method is used to find the data directory.
GLOBAL CONFIGURATION
The global configuration directory has to be writable by the user the program is running-as. One way to do this is to make the directory world-writable. Hopefully a better solution will be implemented in the future.
UNIX-like systems. (Linux FreeBSD OpenBSD NetBSD)
/etc/plconf
Mac OS X / Darwin
/Library/Application Support/plconf
Windows
Not properly supported at the moment.
SUBROUTINES/METHODS
CONSTRUCTOR
new(%options)
Create a new Config::PlConfig object.
Options:
host - The host to access the configuration from.
Can be either local (user) or global (all users).
domain - The configuration domain. Can be any string but a reverse DNS type string
is preferred. i.e com.mycorpname.myapplicationname
The default host is local. There is no default domain.
INSTANCE METHODS
load
Load the configuration file. Returns reference to the configuration hash.
save
Save the configuration file.
get($configuration_key)
Get the value of a configuration key.
DIAGNOSTICS
None.
CONFIGURATION AND ENVIRONMENT
None.
DEPENDENCIES
Class::Dot
YAML::Syck
File::HomeDir
version
INCOMPATIBILITIES
BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests to bug-config-plconfig@rt.cpan.org
, or through the web interface at http://rt.cpan.org.
AUTHOR
Ask Solem <asksh@cpan.org>
LICENSE AND COPYRIGHT
Copyright (c) 2007, Ask Solem <asksh@cpan.org>
. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
# Local Variables: # mode: cperl # cperl-indent-level: 4 # fill-column: 78 # End: # vim: expandtab tabstop=4 shiftwidth=4 shiftround