###
###  Copyright 2000-2007 University of Illinois Board of Trustees
###  All rights reserved. 
###
###  PSGConf::DataStore::ConfigFile - config file data store for psgconf
###
###  Campus Information Technologies and Educational Services
###  University of Illinois at Urbana-Champaign
###


package PSGConf::DataStore::ConfigFile;

use PSGConf::DataStore;
use Config::Objective;

use strict;

our @ISA = qw(PSGConf::DataStore);

###############################################################################
###  read config
###############################################################################

sub read_config
{
	my ($self, $psgconf) = @_;
	my ($file);

	###
	### This looks backwards, but using $psgconf first is so command
	### line options for a config file get processed before a default
	### from the class creation.
	###
	$file = (defined($psgconf->{'config_file'})
		 ? $psgconf->{'config_file'}
		 : $self->{'config_file'});

	Config::Objective->new(
				$file,
				$psgconf->{'data'},
				'include_dir' => $psgconf->{'config_dir'}
			)
		|| die $0 . ": cannot read config file '$file'\n";
}


###############################################################################
###  documentation
###############################################################################

1;

__END__

=head1 NAME

PSGConf::DataStore::ConfigFile - config file data store class for psgconf

=head1 SYNOPSIS

In F<psgconf_modules>:

  DataStore PSGConf::DataStore::ConfigFile config_file=/etc/psg.conf

=head1 DESCRIPTION

The B<PSGConf::DataStore::ConfigFile> module provides a data store
implementation that reads configuration information from a local config
file (typically F</etc/psg.conf>).  It supports the following methods:

=over 4

=item new()

The constructor.  Its arguments are a reference to the B<PSGConf>
object and an optional list of attribute settings in the form
"attribute=value".  The following attributes are supported:

=over 4

=item I<config_file>

The absolute path to the default config file location.  This value is
overriden by the I<config_file> attribute of the B<PSGConf> object.

=back

=item read_config()

Reads the config file.  Its argument is a reference to the B<PSGConf>
object.

=back

The config file parser is implemented using B<Config::Objective>.
See L<Config::Objective> for details on the config file format.

=head1 SEE ALSO

L<perl>

L<PSGConf>

L<psgconf-intro>

L<Config::Objective>

=cut



syntax highlighted by Code2HTML, v. 0.9.1