Smolder::Conf - Smolder configuration module
# all configuration directives are available as exported subs use Smolder::Conf qw(Secret Port); $secret = Secret; # you can also call get() in Smolder::Conf directly $port = Smolder::Conf->get("Port"); # or you can access them as methods in the Smolder::Conf module $port = Smolder::Conf->Port; # give Smolder::Conf some values to override the defaults Smolder::Conf->init( Secret => '1Adxd23023s', Port => 80, HostName => 'smolder.myorg.com', LogFile => '/path/to/logs', ); # pull the conf values from a file Smolder::Conf->init_from_file('/path/to/conf/file');
This module provides access to the configuration settings in smolder.conf. Smolder tries to have reasonable defaults but they can be overridden when needed.
Override the configuration defaults by providing named-value pairs:
Smolder::Conf->init( Secret => '1Adxd23023s', Port => 80, HostName => 'smolder.myorg.com', LogFile => '/path/to/logs', );
Override the configuration defaults by providing a file. Config files are simple lists of name-values pairs. One pair per-line and each name/value is separated by whitespace:
HostName smolder.test DataDir /var/lib/smolder/ Port 80 FromAddress smolder@smolder.test TemplateDir /var/share/smolder/templates HtdocsDir /var/share/smolder/htdocs SQLDir /var/share/smolder/sql
Given a directive name, returns the value (which may be a list) of a configuration directive. Directive names are case-insensitive.
$value = Smolder::Conf->get('DirectiveName');
The directory path for test data directory for this copy of Smolder
All configuration directives can be accessed as methods themselves.
my $port = Smolder::Conf->port();
Gets the value of a directive using an autoloaded method. Directive names are case-insensitive.
Each configuration directive can also be accessed as an exported subroutine.
use Smolder::Conf qw(port FromAddress); ... my $port = port(); my $from = FromAddress();
Directive names are case-insensitive. Gets the value of a variable using an exported, autoloaded method. Case-insensitive.
To install Smolder, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Smolder
CPAN shell
perl -MCPAN -e shell install Smolder
For more information on module installation, please visit the detailed CPAN module installation guide.