NAME

Thorium::BuildConf - Configuration management class

VERSION

version 0.510

SYNOPSIS

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;

DESCRIPTION

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.

FEATURES

CONFIGURATION CONSOLE GUI

Thorium::BuildConf uses Hobocamp (bindings for dialog(1)) and it's widget set for an interactive console user interface.

FILE GENERATION

You should use

KNOBS

A knob is anything that is tunable with strict or loose input validation. See Thorium::BuildConf::Knob for creating your own custom knob.

PRESETS

A preset is a static YAML data specific to a user or an environment. These are generally found in the directory 'conf/presets' under your application root. However these files can be in any location under your application root by changing preset_path default in your subclass, such as:

has '+preset_path' => ('default' => sub { [ 'perl', 'conf', 'presets' ] } );

ATTRIBUTES

Required Attributes

  • conf (rw, Maybe[Thorium::Conf])

    Configuration object.

  • files (rw, ArrayRef|Str)

    String or list of files to be processed (Template Toolkit format).

  • knobs (ro, Any)

    Thorium::BuildConf::Knobs derived object.

Optional Attributes

  • 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.

PUBLIC API METHODS

  • run()

    This method starts the processing templates, saving/loading of the presets, etc.

AUTHOR

Adam Flott <adam@npjh.com>

COPYRIGHT AND LICENSE

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.