in reply to Re: Program configuration in the OOP world
in thread Program configuration in the OOP world

Don't despair. Put together the Class::Singleton and AppConfig suuguestions. Then you can just have:

package Some::Module; use MyConfig; ## ... sub do_something { my $self = shift; my $config = MyConfig->instance; $self->_blah_de_blah() if $config->do_blah(); return $self->bloop() unless $config->no_bloop(); }

Nobody had to pass anyone else anything.

Replies are listed 'Best First'.
Re: Re: Re: Program configuration in the OOP world
by lachoy (Parson) on Apr 10, 2002 at 14:38 UTC

    For an example of how to set this up with Class::Singleton (using just hardcoded info), see Re: how to make a universally inherited method?. For non-hardcoded info, just have it call some configuration reading routine to set the data.

    The usage suggested by Fletch is fairly simple and quite powerful. You just need to setup (read in) your configuration once and then it's available to all your modules in that process.

    Chris
    M-x auto-bs-mode