NAME
Fink::Config - Read/write the fink configuration
SYNOPSIS
use Fink::Config; my $config = Fink::Config->new_with_path($config_file);
my $value = $config->param($key); $config->set_param($key, $value); $config->save;
DESCRIPTION
A class representing the fink configuration file as well as any command line options. Fink::Config inherits from Fink::Base.
Fink::Config will not work without a Fink::Config object having been made that contains a basepath. The fink program typically does this for you. Since the variables Fink::Config exports use data from the last initialized Fink::Config object, creating a second object is not recommended.
Constructors
- new
- new_from_properties
Inherited from Fink::Base.
- new_with_path
my $config = Fink::Config->new_with_path($config_file); my $config = Fink::Config->new_with_path($config_file, \%defaults);
Reads a fink.conf file into a new Fink::Config object and initializes Fink::Config globals from it.
If %defaults is given they will be used as defaults for any keys not in the config file. For example...
my $config = Fink::Config->new_with_path($file, { Basepath => "/sw" });
- initialize
$self->initialize;
Initialize Fink::Config globals. To be called from any constructors.
Configuration queries
- get_path
my $path = $config->get_path;
Returns the path to the configuration file which $config represents.
- get_treelist
my @trees = $config->get_treelist;
Returns the Trees config value split into a handy list.
- param
- param_default
- param_boolean
- has_param
- set_param
Inherited from Fink::Base.
- save
$config->save;
Saves any changes made with set_param() to the config file.
- write_sources_list
$config->write_sources_list;
Writes an appropriate $basepath/etc/apt/sources.list file, based on configuration information. Called automatically by $config->save.
Exported Functions
These functions are exported only on request
- set_options
set_options({ key1 => val1, key2 => val2, ...});
Sets global configuration options, mostly used for command line options.
- get_option
my $value = get_option($key); my $value = get_option($key, $default_value);
Gets a global configuration option. If the $key was never set, $default_value is returned.
- verbosity_level
my $level = verbosity_level;
Determine the current verbosity level. This is affected by the --verbose and --quiet command line options as well as by the "Verbose" setting in fink.conf.
- binary_requested
my $boolean = binary_requested;
Determine whether the binary distribution or compilation has been requested. This is affected by the --use-binary-dist and --compile-from-source command line options as well as by the "UseBinaryDist" setting in fink.conf. Returns 1 for binary distribution, 0 for compile-from-source.
Exported Variables
These variables are exported on request. They are initialized by creating a Fink::Config object.
- $basepath
Path to the base of the Fink installation directory.
Typically /src.
- $buildpath
Directory where fink packages will be built.
Typically $basepath/src
- $config
The last Fink::Config object created.
- $debarch
Debian-style name of the current architecture.
Typically
darwin-powerpc
. - $distribution
Fink package distribution being used.
For example,
10.2
. - $libpath
XXX Don't understand this one.