POEST::Config::General - Configuration via Config::General


poest documentation Contained in the poest distribution.

Index


Code Index:

NAME

Top

POEST::Config::General - Configuration via Config::General

ABSTRACT

Top

A poest configurator based on Config::General, a file based configuration.

DESCRIPTION

Top

The description of the configuration file is explained in Config::General. This configuration class conforms to the specification explained in POEST::Config.

Example Configuration

  Hostname localhost
  Port 2525

  Plugin POEST::Plugin::General
  Plugin POEST::Plugin::Check::Hostname

  RequireHost Yes
  AllowedHost localhost
  AllowedHost example.com

If no configuration file is passed, a list of reasonable default directories are checked for poest.conf.



 /usr/local/etc
 /usr/local/etc/poest
 /etc/poest
 ./
 ./etc
 ~/
 ~/etc
 ~/.poest

AUTHOR

Top

Casey West, <casey@dyndns.org>

COPYRIGHT AND LICENSE

Top

SEE ALSO

Top

perl, POEST::Server, POEST::Config, Config::General.


poest documentation Contained in the poest distribution.
# $Id: General.pm,v 1.2 2003/03/22 17:06:17 cwest Exp $
package POEST::Config::General;

use strict;
$^W = 1;

use vars qw[$VERSION];
$VERSION = (qw$Revision: 1.2 $)[1];

use Config::General;
use base qw[POEST::Config];
use Carp;

sub new {
	my ($class, %args) = @_;

	ATTEMPT: unless ( $args{ConfigFile} ) {
		my @locations = qw[
			/usr/local/etc
			/usr/local/etc/poest
			/etc/poest
			./
			./etc
			~/
			~/etc
			~/.poest
		];
		
		foreach ( @locations ) {
			if ( -e "$_/poest.conf" && -f _ && -s _ ) {
				$args{ConfigFile} = "$_/poest.conf";
				last ATTEMPT;
			}
		}
	}

	croak 'ConfigFile is empty' unless $args{ConfigFile};

	my $self = { ParseConfig(
		-ConfigFile     => $args{ConfigFile},
		-LowerCaseNames => 1,
	) };
	
	return bless $self, $class;
}

1;

__END__