NAME
OpenInteract::Config::GlobalOverride -- Process global override settings for a set of configuration directives
SYNOPSIS
## ----------Sample of an override file----------
# Add a new value to 'user.track'
[user.track.finalize]
action = add
value = 1
# Add two new entries to the ruleset for the 'news' object, giving
# the system a hint as to what type of data it should be
[news.rules_from]
action = add
value = OpenInteract::RSSArticleSummarize
value = OpenInteract::EditorApproval
type = list
# Remove 'SPOPS::Secure' from 'page.isa' list
[page.isa]
action = remove
value = SPOPS::Secure
# Remove key and value for 'uid' from 'user.field_map' hash
[user.field_map]
action = remove
value = uid
# Remove the entire 'field_alter' hashref
[user.field_alter]
action = remove
# Replace 'SPOPS::DBI::MySQL with 'SPOPS::DBI::Pg' in all keys that
# have an 'isa' entry
[*.isa]
action = replace
replace = SPOPS::DBI::MySQL
value = SPOPS::DBI::Pg
# Replace 'SPOPS::DBI::MySQL with 'SPOPS::DBI::Sybase' in the
# 'user.isa' list
[user.isa]
action = replace
replace = SPOPS::DBI::MySQL
value = SPOPS::DBI::Sybase
## ----------End sample override file----------
## Read in a configuration and apply the override file, saved for
## this example in global_override.ini
my $config = OpenInteract::Config->new(
'ini', { filename => 'server.ini' } );
my $override_file = join( '/', $config->{dir}{config},
'global_override.ini' );
my $override = OpenInteract::Config::GlobalOverride->new( $override_file );
$override->apply_rules( $config );
## Values in $config are now modified based on the given rules
DESCRIPTION
This class allows you to define a set of override rules and apply them to a configuration. This is very helpful in OpenInteract because large sections of the server configuration are pieced together from information in a number of packages. Since there can be any number of packages -- at least 14, and most likely more -- modifying each of these is time-consuming and error-prone. Additionally, you need to modify the configuration for a package every time you upgrade.
Instead of this hassle, you can now define rules in a single file that will modify any configuration value. You have three ways to do this:
add: Add/overwrite a value to an existing list or hash.
remove: Remove a particular value from a list, or delete a hash key.
replace: Replace a value with another in a list.
Action: Add
Action: Remove
Action: Replace
METHODS
Class Methods
new( $rule_filename )
Object Methods
apply_rules( $config )
BUGS
None known.
TO DO
Nothing known.
SEE ALSO
COPYRIGHT
Copyright (c) 2002 intes.net, inc.. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
AUTHORS
Chris Winters <chris@cwinters.com>