OpenInteract::Config::GlobalOverride -- Process global override settings for a set of configuration directives


 ## ----------Sample of an override file----------

 # Add a new value to 'user.track'

 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

 action  = add
 value   = OpenInteract::RSSArticleSummarize
 value   = OpenInteract::EditorApproval
 type    = list

 # Remove 'SPOPS::Secure' from 'page.isa' list

 action  = remove
 value   = SPOPS::Secure

 # Remove key and value for 'uid' from 'user.field_map' hash

 action  = remove
 value   = uid

 # Remove the entire 'field_alter' hashref
 action  = remove

 # Replace 'SPOPS::DBI::MySQL with 'SPOPS::DBI::Pg' in all keys that
 # have an 'isa' entry

 action  = replace
 replace = SPOPS::DBI::MySQL
 value   = SPOPS::DBI::Pg

 # Replace 'SPOPS::DBI::MySQL with 'SPOPS::DBI::Sybase' in the
 # 'user.isa' list

 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


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


Class Methods

new( $rule_filename )

Object Methods

apply_rules( $config )


None known.


Nothing known.



Copyright (c) 2002, inc.. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


Chris Winters <>