Perlbug::Config - Perlbug Configuration data handler


Perlbug documentation  | view source Contained in the Perlbug distribution.

Index


NAME

Top

Perlbug::Config - Perlbug Configuration data handler

DESCRIPTION

Top

Configuration data for the Perlbug bug tracking system.

Be sure to set the 'Perlbug_CONFIG' environment variable to the correct site configuration file, and/or fix the line at the top of this module.

Set methods are provided only for current() parameters, the rest are all gettable only, and settable only from the configuration file.

SYNOPSIS

Top

	my $o_conf = Perlbug::Config->new($cfgfile);

	my $format = $o_conf->current('format');

	my $debug = $o_conf->current('debug');	




METHODS

Top

new

Create new Config object with all prefs set.

    my $conf = Perlbug::Config->new($cfg);

relog

Redirect log output to STDOUT (if $Perlbug_DEBUG =~ /[dD]/

	$o_conf->relog;

error

confess or cluck or carp, dependent on $Perlbug::(DEBUG|FATAL) settings

	my $i_ok = $o_conf->error($err_msg);

get_config_data

Retrieve data from site configuration file

    my ($ok, $h_data) = get_config_data($config_file_location);

update_data

Update config data structure for current/local environment

	my ($ok, $h_data) = &update_data(\%data);

set_debug

Set debug level, returns $o_conf, see Perlbug::Base::debug();

	my $debug = $o_conf->set_debug(2);

set_env

Sets ENVIRONMENT and PACKAGE variables in config hash for reference

	my $prefs = $o_conf->set_env($prefs);

prime_data

Prime config data structure

    my ($ok, $h_data) = prime_data(\%data);

set_alarm

Sets Perlbug alarm process so we don't go on for ever :-)

UTILITIES

Certain utility methods are available against the configuration object

get_date

Returns common date for use throughout Perlbug.

	my $date = get_date;     # -> 19980815 - 20010728

get_keys

Return list of Config keys of given key

	my @keys = $o_conf->get_keys('current'); 	# have a look

get_vals

Return list of Config values of given key

	my @vals = $o_conf->get_vals('current'); 	# have a look

get_all

Return mapping of each Config key=val

	print $o_conf->get_all('current'); # -> context=ascii ...

get_config

Return textual representation of config data

	print $o_conf->get_config('system');

ACCESSORS

Top

Accessor methods are provided for the following configuration data structures:

		CURRENT SYSTEM DATABASE DIRECTORY 
		TARGET FORWARD FEEDBACK
		MESSAGE EMAIL WEB
		DEFAULT GROUP SEVERITY STATUS VERSION

Retrieve the value:

	my $user = $o_config->system('user');

	my $target = $o_config->target('generic');

Note that current is the only one available for modification, and that it returns keys of succesful updates (note the hashref).

	my $attr = $self->current('format'); 			# get one

	my @keys = $self->current();					# get all

	my $data = $self->current({'format' => 'h'});	# set $data = 'format'

	my @data = $self->current(						# set @data = qw(format context)
		{'format' => 'a', 'context'	=> 'html'}
	); 	

AUTHOR

Top

Richard Foley perlbug@rfi.net 1999 2000 2001


Perlbug documentation  | view source Contained in the Perlbug distribution.