ServerRoot "d:/wamp/apache2"
Timeout 300
Alias /icons/ "d:/wamp/Apache2/icons/"
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
Alias /manual/ "d:/wamp/Apache2/htdocs/manual/"
Options Indexes
AllowOverride None
Order allow,deny
Allow from all
SetHandler type-map
SetEnvIf Request_URI ^/manual/(de|en|es|fr|ja|ko|ru)/ prefer-language=$1
RedirectMatch 301 ^/manual(?:/(de|en|es|fr|ja|ko|ru)){2,}(/.*)?$ /manual/$1$2
ScriptAlias /cgi-bin/ "d:/wamp/Apache2/cgi-bin/"
AllowOverride None
Options None
Order allow,deny
Allow from all
####
security = user
workgroup = WORKGROUP
[homes]
comment = Home Directories
browseable = no
writable = yes
readonly = no
available = yes
public = no
####
---
name: ingy
age: old
weight: heavy
# I should comment that I also like pink, but don't tell anybody.
favorite colors:
- red
- green
- blue
####
use CFI;
# OBJECT = new( FORMAT );
# FORMAT - scalar string denoting the file format to use
# note that the case of the format wouldn't matter..."inifiles" and "IniFiles" would be equivalent
my $config_general = new CFI('general');
my $config_inifiles = new CFI('inifiles');
my $config_yaml = new CFI('yaml');
####
# BOOLEAN = ->read_config( SOURCE, OPTIONS );
# SOURCE - scalar containing filename, scalar ref containing file contents, or filehandle to read from
# OPTIONS - hash reference containing any driver-specific options
$config_general->read_config(\*CONFIG_FILE, { -AllowMultiOptions => 1, -AutoTrue => 1 });
$config_inifiles->read_config('./test.ini', { -nocase => 1, -allowcontinue => 1, -commentchar => ';' });
$config_yaml->read_config(\$default_values);
# BOOLEAN = ->write_config( DESTINATION, OPTIONS );
# DESTINATION - scalar containing filename, or scalar ref to assign contents to, or filehandle to write to
# OPTIONS - hash reference containing any driver-specific options
$config_general->write(\*CONFIG_OUTPUT);
$config_yaml->write('~/test.yml');
####
# VALUE = ->param( BLOCKS, FIELD );
# BLOCKS - name(s) of any number of logical blocks (or a single undef to use default (root) block)
# FIELD - name of field to retrieve (or undef to retrieve all fieldnames in given block)
# parameters are name:value pairs. if undef is passed as a parameter, return a list of all parameters in current block
$config_general->param('Directory','d:/wamp/Apache2/htdocs/manual','Files','*.html','SetHandler'); # returns 'type-map'
$config_inifiles->param('homes',undef); # returns array ('comment','browseable','writable','readonly','available','public')
$config_yaml->param('favorite colors'); # returns ['red','green','blue']
# VALUE = ->block( BLOCKS );
# BLOCKS - name(s) of any number of logical blocks (or a single undef to use default (root) block)
# blocks are groups or sections that contain parameters
$config_general->block('Directory'); # returns ('d:/wamp/Apache2/icons','d:/wamp/Apache2/htdocs/manual','d:/wamp/apache2/cgi-bin')
$config_inifiles->block(); # returns ('homes')
$config_yaml->block(); # returns ('name','age','weight','favorite colors')
# HASHREF = ->export();
# this exports the entire configuration as a hashref structure. useful for converting one format to another
# BOOLEAN = ->import( CONFIG );
# CONFIG - hash reference containing an entire configuration
# this takes a structure of anonymous hashes and arrays and interprets it as a config structure.
$config_general->import( $config_yaml->export() );