
# Load the module
use Config::IniFiles;

# Tie the hash "config" to a new instance of the Config::iniFiles
# class, loaded with the config file given
tie my %config, 'Config::IniFiles', ( -file => "udb.ini");

# If there were parsing errors, config will be undef
if (!defined(%config))
{
    print "Error!\n";
    # In case of errors, this variable contains an array of strings,
    # reporting the error
    foreach $error (@Config::IniFiles::errors) {
	print "$error\n";
    }
    exit(1);
}

# config is now a hash of hashes.  Loop over this to peel out the
# information
foreach $section_name (keys %config) {
  print "$section_name:\n";
  my %section_hash = %{$config{$section_name}};

  foreach $item (keys %section_hash) {
      my $value = ${section_hash{$item}};
      print "  $item => $value\n";
  }
}
