Newcomen

Description A static content generator.
Newcomen > Perl Modules > Newcomen::Config::Perl
Source

Index


NAME ^

Newcomen::Config::Perl - Configuration backend to read a Perl configuration file.

SYNOPSIS ^

use Newcomen::Config;

my $config = Newcomen::Config -> new ();

# Use the Newcomen::Config::Perl backend to load user configuration:
$config -> add_config ('perl', { 'file' => 'config/config.pl' });

DESCRIPTION ^

Configuration backends are usually not called directly. See Newcomen::Config for the frontend documentation.

This configuration backend will read a configuration file written in Perl. The file has to return a hashref containing the user configuration. The following example would be a valid configuration file:

{
   plugins => {
      'Newcomen' => 1,
   },
};

Warning

The Perl code in the configuration file will be executed. Any valid Perl command may be run. Never use a configuration file from an untrusted source without checking it first. You have been warned!

OPTIONS ^

The only option accepted is file (see SYNOPSIS for an example), which must contain the location of the configuration file to be used. The location may be an absolute or - preferably - a relative path. If no path is specified, if the file can not be read or is invalid for some reason, the backend will die().

CLASS METHODS ^

new

my $backend = Newcomen::Config::Perl -> new ();

Constructor, expects no parameters. See Newcomen::Config::Backend's new() method for a full description.

INSTANCE METHODS ^

config

my $config = $backend -> config ($backend_options);

Returns the configuration hashref that is returned by the configuration file. The file will be processed using Perl's do() function. If this fails for some reason, this backend will die(). config() expects the backend options (either an Newcomen::Data instance or undef) to be supplied as the only parameter, valid backend options and their default values are described above.

SEE ALSO ^

Newcomen::Config, Newcomen::Config::Backend, Newcomen::Data

VERSION ^

This is version 2014052501.

AUTHOR ^

Stefan Goebel - newcomen {at} subtype {dot} de

COPYRIGHT AND LICENSE ^

Copyright 2013-2014 Stefan Goebel.

This file is part of Newcomen.

Newcomen is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the license, or (at your option) any later version.

Newcomen is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Newcomen. If not, see <http://www.gnu.org/licenses/>.