[Chicago-talk] PAUSE indexer report LEMBARK/Schedule-Depend-1.2.tar.gz (fwd)

Steven Lembark lembark at wrkhors.com
Fri Apr 9 21:24:08 CDT 2004

>>      module: Schedule::Depend::Config
>>     version: 0.4
>>     in file: Schedule-Depend-1.2/lib/Schedule/Depend/Config.pm
>>      status: indexed

This is used for managing configuration data between
modules. Basic idea starts with a hash:

    %Schedule::Depend::Execute::defaults =
		global =>
			foo  => 'bar',
			blah => 'blah',

		Foo  =>
			bletch => [ qw( blort bim bam ) ]
			blah => 'bletch'

		Bar =>
			bletch => 'frobnicate',

The global items are, well..., global. They can be
overridden within a particular module's data but
the keys in it will always be present. The other
sections are keyed by module names. In the example
above a module in Some::Namespace::Foo would get
the merged results of global and Foo (i.e.,
(split /::/, $caller)[-1] ), another module in
Another::Plase::Bar gets the merged results of
global and Bar.

The results come back as a flat hash, i.e.,

	my $global = $config->{global};
	my $module = $config->{$modname};

	my $result = { %$global, %$module };

That allows the caller to use something like:

	my $que = shift;

	my $config = $que->moduleconfig;

	my $foo = $config->{foo};

	my $bletch = $config->{bletch};

Cute thing is that the module overrides any
global setting so that "blah" means something
different for the Foo module.

This helps solve one of the nasty issues in
multi-job scheduling: how to keep the configuration
information in one place but allow simple access
to it in the various places it's used. The Execute
module uses S::D and Config as bases so that the
que object carries the configuration data around
with it (which also leaves things a bit more graceful
across forks).


Steven Lembark                               2930 W. Palmer
Workhorse Computing                       Chicago, IL 60647
                                            +1 888 359 3508

More information about the Chicago-talk mailing list