#!/usr/bin/perl
# -----------------------------------------------------------------------------
# TWC
# Treuwert-Computer GmbH
# Schloßbergring 9
# 79098 Freiburg
#
# Author: Klaus Reger <K.Reger@twc.de>
#
# -----------------------------------------------------------------------------
# Program-Data
# -----------------------------------------------------------------------------
# Project  :
# System   :
# Program  :
# Module   : $RCSfile: TestConfigPool.t,v $
# Version  : $Revision: 1.1 $
# Date     : $Date: 2002/02/28 15:23:50 $
# State    : $State: Exp $
#
# Description:
#   This module handles all the things of WWWdb, which have
#   to do with ConfigFile
#
# Change-log (See at end of this file)
#
# --- Known Bugs -------------
# please look at the BUGS-File
# --- TODO -------------------
# please look at the TODO-File
# ----------------------------------------------------------------------------


use WWWdb::ConfigFile;
use WWWdb::ConfigPool;

my $oContactFile;

$oConfigPoolGL = ConfigPool->new();

$oConfigFileGL = ConfigFile->new("../lib/WWWdb/Pre.rc",
                                 ReadOnly => 1);
$oConfigPoolGL->addConfigFile($oConfigFileGL);

$oConfigFileGL = ConfigFile->new("../lib/WWWdb/Db/Default.rc",
                                 ReadOnly => 1);
$oConfigPoolGL->addConfigFile($oConfigFileGL);

$oContactFile = ConfigFile->new("../lib/WWWdb/Demo/Contacts.rc");
$oConfigPoolGL->addConfigFile($oContactFile);

$oConfigFileGL = ConfigFile->new("../lib/WWWdb/Post.rc",
                                 ReadOnly => 1);
$oConfigPoolGL->addConfigFile($oConfigFileGL);

print "The contents of this pool:\n";
foreach $cSection ($oConfigPoolGL->getSectionNames())
{
   print "EntryNames of [$cSection]:\n";
   foreach $cEntry ($oConfigPoolGL->getEntryNames($cSection))
   {
      printf ("\t%s = %s\n",
              $cEntry,
              $oConfigPoolGL->getValue($cSection, $cEntry, ""));
   }

}


$cValue = $oConfigPoolGL->getValue("Layout Field comments", "Type", "???");
print "get [Layout Field comments]->Type = $cValue\n";

$cValue = $oConfigPoolGL->getValue("WWWdb", "Test", "???");
print "get [WWWdb]->Test = $cValue\n";

$cValue = $oConfigPoolGL->setValue("WWWdb", "Test", "Set by Program");
print "set [WWWdb]->Test = $cValue\n";

$oContactFile->setValue("WWWdb", "Test", "Set in ConfigFile by Program");

$cValue = $oConfigPoolGL->setValue("WWWdb", "Test",
                                   "Set in ConfigPool by Program");
print "set [WWWdb]->Test = $cValue\n";

$cValue = $oConfigPoolGL->getValue("WWWdb", "Test", "???");
print "get [WWWdb]->Test = $cValue\n";

# <>;


$oConfigPoolGL->ShowAttributes();

$oConfigPoolGL->Dump();




