PkgForge::ConfigFile - A configuration file class for the LCFG Package Forge
This documentation refers to PkgForge::ConfigFile version 1.4.8
This is a Moose role and cannot be instantiated directly. Use it as shown below: package PkgForge::Foo; use Moose; with 'PkgForge::ConfigFile'; # optionally, default the configfile: has '+configfile' => ( default => '/etc/foo.yaml' ); ######## ## A script that uses the class with a configfile ######## my $obj = PkgForge::Foo->new_with_config(configfile => '/etc/bar.yaml', other_opt => 'foo');
This is a Moose role which can be applied to a class to give it the ability to set values of attributes for new instances from configuration files. The configuration file format must be YAML, multiple files can be supplied which will be loaded in sequence.
This attribute is provided by the base role MooseX::ConfigFromFile. You can provide a default configfile pathname like so:
has '+configfile' => ( default => '/etc/myapp.yaml' );
You can also provide a list of files (wrapped in a sub to satisfy Moose) as a default. Given a list of files the values of attributes will come from the latest (right-most) file in which the attribute is specified. The configuration format is YAML, in most cases all that is required are simple key-value pairs separated with a colon, one per-line, for example
bucket: lcfg, see YAML::Syck for more information.
This is provided by the base role MooseX::ConfigFromFile. This acts just like a regular
new(), but it also accepts an argument
configfile to specify the configuration file from which to load other attributes. Explicit arguments to this method will override anything loaded from the configfile. You may also pass in a string which is the filename for the configuration file but with a plus-sign (+) prefix. This file name will then be appended to the list which comes from the default for the attribute (if any).
This is the list of platforms on which we have tested this software. We expect this software to work on any Unix-like platform which is supported by Perl.
Please report any bugs or problems (or praise!) to email@example.com, feedback and patches are also always very welcome.
Stephen Quinney <firstname.lastname@example.org>
Copyright (C) 2010-2011 University of Edinburgh. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the terms of the GPL, version 2 or later.