NAME

Config::IniHash - Perl extension for reading and writing INI files

version 2.7

SYNOPSIS

use Config::IniHash;
$Config = ReadINI 'c:\some\file.ini';

DESCRIPTION

This module reads and writes INI files.

Functions

ReadINI

$hashreference = ReadINI ($filename, %options)

The returned hash contains a reference to a hash for each section of the INI.

  [section]
  name=value
leads to
  $hash->{section}->{name}  = value;

The available options are:

heredoc

- controls whether the module supports the heredoc syntax :

name=<<END
the
many lines
long value
END
othername=value

Default: 0 = OFF

systemvars

- controls whether the system variables enclosed in %% are interpolated.

  name=%USERNAME%
leads to
  $data->{section}->{name} = "Jenda"

Default: 1 = ON

case

- controls whether the created hash is case insensitive. The possible values are

sensitive	- the hash will be case sensitive
tolower	- the hash will be case sensitive, all keys are made lowercase
toupper	- the hash will be case sensitive, all keys are made uppercase
preserve	- the hash will be case insensitive, the case is preserved
lower	- the hash will be case insensitive, all keys are made lowercase
upper	- the hash will be case insensitive, all keys are made uppercase
withdefaults

- controls whether the created section hashes support defaults.

sectionorder

- if set to a true value then created hash will contain

$config->{'__SECTIONS__'} = [ 'the', 'names', 'of', 'the', 'sections', 'in', 'the',
	'order', 'they', 'were', 'specified', 'in', 'the', 'INI file'];
forValue

- allows you to install a callback that will be called for each value as soon as it is read but before it is stored in the hash. The function is called like this:

$value = $forValue->($name, $value, $sectionname, $INIhashref);

If the callback returns an undef, the value will not be stored.

You may also set the defaults for the options by modifying the $Config::IniHash::optionname variables. These default settings will be used if you do not specify the option in the ReadINI() or ReadSection() call.

ReadSection

$hashreference = ReadSection ($string)

This function parses a string as if it was a section of an INI file and creates a hash with the values. It accepts the same options as ReadINI.

WriteINI

WriteINI ($filename, $hashreference)

Writes the hash of hashes to a file.

PrintINI

The same as WriteINI().

AUTHOR

Jan Krynicky <Jenda@Krynicky.cz> http://Jenda.Krynicky.cz

COPYRIGHT

Copyright (c) 2002-2003 Jan Krynicky <Jenda@Krynicky.cz>. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. There is only one aditional condition, you may NOT use this module for SPAMing! NEVER! (see http://spam.abuse.net/ for definition)