The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Templer::Global - Configuration-file parser for templer.

SYNOPSIS

    use strict;
    use warnings;

    use Templer::Global;

    my $site   = Templer::Global->new( file => "./templer.cfg" );
    my $suffix = $site->field( "suffix" );

DESCRIPTION

This class is responsible for parsing the top-level templer.cfg file which we assume will be present in a templer-based site.

The file is a simple key=value store, with comments being prefixed by the hash ("#") character, and ignored.

This object is created when templer is started so that the options may be parsed/read. Once that happens the options are merged with the command-line flags, and this object isn't touched again.

LICENSE

This module is free software; you can redistribute it and/or modify it under the terms of either:

a) the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version, or

b) the Perl "Artistic License".

AUTHOR

Steve Kemp <steve@steve.org.uk>

COPYRIGHT AND LICENSE

Copyright (C) 2012-2015 Steve Kemp <steve@steve.org.uk>.

This library is free software. You can modify and or distribute it under the same terms as Perl itself.

METHODS

new

Constructor.

Any parameters specified in our single hash-argument are saved away, the filename specified in the 'file' parameter will be opened and parsed.

_readGlobalCFG

Read the specified configuration file. Called by the constructor if a filename was specified.

field

Retrieve a value from the file, by key.

This is only called by templer to retrieve the pre/post-build commands to execute.

fields

Retrieve all known key/value pairs.

This is called by templer to retrieve all global settings, which can then be merged with its defaults.