in reply to Re: Application-wide configuration
in thread Application-wide configuration

Yeah, that looks much like what I'm doing.

Why do you need the get method? Shouldn't that be accessible through the instance?

You can also put it the other way round: why do you need instances if you can get things with a class method?

I may misunderstand something.

Discussion on subclassing and its uses (above) may also apply if your usage patterns are similar to mine; that's a matter of taste, though. (You'll need to use a fully qualified name for $_config in this module if you do subclass).

Replies are listed 'Best First'.
Re^3: Application-wide configuration
by skx (Parson) on Jul 27, 2007 at 22:05 UTC

    In the code above you need the get method because the singleton returns an instance of itself, not of the configuration object.

    So usage becomes:

    my $config = Singleton::Config->instance(); my $random = $config->get( "block", "setting" );
    Steve
    --