NAME

ALPM::LoadConfig - pacman.conf config file parsing class.

SYNOPSIS

# At startup:
use ALPM qw( /etc/pacman.conf );

# At runtime:
ALPM->load_config('/etc/pacman.conf');

# Load custom fields as well:
my $value;
my %fields = ( 'CustomField' => sub { $value = shift } );
my $loader = ALPM::LoadConfig->new( custom_fields => \%fields,
                                    auto_register => 0 );
$loader->load_file( '/etc/pacman.conf' );

DESCRIPTION

This class is used internally by ALPM to parse pacman.conf config files. The settings are used to set ALPM options. You probably don't need to use this module directly.

CONSTRUCTOR

new

$OBJ = ALPM::LoadConfig->new( custom_fields => $FIELDS_REF,
                              auto_register => $AUTO_REGISTER );

Parameters

$FIELDS_REF (Hash Reference)

Keys are field names from the /etc/pacman.conf configuration file. Values are code references. When a field is found inside the configuration file with the exact same name, then the code reference is called, passed the value of the entry as the only argument.

$AUTO_REGISTER

Normally, LoadConfig will automatically call ALPM-register_db( 'local' )> to register the local database after it has read the config file. If you want to override certain ALPM settings immediately after reading the config file you will have to turn this feature off. This is used as a boolean value, set it to 0 to disable automatic localdb registering.

METHODS

load_config

undef = $OBJ->load_config( $CFG_FILE_PATH )

This method will read a configuration file, setting ALPM options as it goes.

Parameters

$CFG_FILE_PATH

The path to the configuration file to read.

SEE ALSO

ALPM

AUTHOR

Justin Davis, <juster at cpan dot org>

COPYRIGHT AND LICENSE

Copyright (C) 2010 by Justin Davis

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.