Thorium::BuildConf - Configuration management class
version 0.503
This class should be extended and customized to your application.
package Some::App::BuildConf; use Thorium::Protection; use Moose; extends 'Thorium::BuildConf'; use Thorium::BuildConf::Knob::URL::HTTP; has '+files' => ('default' => 'config.tt2'); has '+knobs' => ( 'default' => sub { [ Some::App::BuildConf::Knob::URL::HTTP->new( 'conf_key_name' => 'some_app.', 'name' => 'favorite web site', 'question' => 'What is your favorite web site?' ) ]; } ); __PACKAGE__->meta->make_immutable; no Moose;
And driven by a configure script
#!/usr/bin/env perl use strict; use Some::App::BuildConf; Some::App::BuildConf->new( 'conf_type' => 'Some::App::Conf', )->run;
Thorium::BuildConf consists of two main parts. The configuration console GUI and the file generator.
The configuration console GUI provides a way someone unfamiliar with your application to alter the defaults. They may save a version into their own preset or use a fixup.
Thorium::BuildConf uses Hobocamp (bindings for dialog(1)) and it's widget set for an interactive console user interface.
dialog(1)
You should use
A knob is anything that is tunable with strict or loose input validation. See Thorium::BuildConf::Knob for creating your own custom knob.
A preset is a static YAML data specific to a user or an environment.
conf (rw, Maybe[Thorium::Conf])
rw
Maybe[Thorium::Conf]
Configuration object.
files (rw, ArrayRef|Str)
ArrayRef|Str
String or list of files to be processed (Template Toolkit format).
knobs (ro, Any)
Thorium::BuildConf::Knobs derived object.
auto_fixup_module (rw, Str)
Class name of auto fix up module. This fixup will be run last on every processing of the templates. Even if you specify one on the command line via <--fixup>.
action (rw, Str)
Name of action (set via configure).
fixup (rw, Str)
Fixup class name.
is_interactive (rw, Bool)
Whether or not we are connected to a terminal that accepts standard in.
preset (rw, Str)
Preset name.
preset_root (rw, Str)
Directory root of the presets e.g. $self->root + "conf/presets".
root (rw, Str)
Directory root of the configuration files.
script_name (ro, Str)
File name of the script that instantiated us.
run()
This method starts the processing templates, saving/loading of the presets, etc.
Adam Flott <adam@npjh.com>
This software is copyright (c) 2011 by Adam Flott <adam@npjh.com>, CIDC.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Thorium, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Thorium
CPAN shell
perl -MCPAN -e shell install Thorium
For more information on module installation, please visit the detailed CPAN module installation guide.