[Catalyst] Merging configs

Bill Moseley moseley at hank.org
Thu Mar 8 22:06:55 GMT 2007


My YAML file has sections that are specific to what server
is running.  That is, I have:

# Default config
foo: bar
name: foo

servers:

    staging:
        config:
            foo: baz
            ...

    devel:
        config:
            ...

    production:
        config:
            ...

So in my setup() I do basically:

    $self->config( $self->config->{servers}{$server_mode}{config} );


Of course, that's a shallow hash merge.


Now, my YAML config also configures my View::TT, for example:

V::TT:
    WRAPPER: page/wrapper.tt
    PRE_PROCESS: config.tt
    TEMPLATE_EXTENSION: .tt
    PRE_CHOMP: 0
    POST_CHOMP: 0
    TIMER: 0

and I'd like to be able to do something like this:


servers:
    devel:
        config:
            V::TT:
                DEBUG: provider
                BLA: 123

but that shallow merge above wipes out the initial V::TT settings.

Is the answer Hash::Merge?  Or does Catalyst have anything to help
here?






-- 
Bill Moseley
moseley at hank.org




More information about the Catalyst mailing list