I'm confused about this rather stern note in Catalyst.pm.

Is this the following wrapper related to the text in the NOTE?

B<NOTE:> you MUST NOT call C<< $self->config >> or C<< __PACKAGE__->config
>>
as a way of reading config within your code, as this B<will not> give you
the
correctly merged config back. You B<MUST> take the config values supplied to
the constructor and use those instead.

=cut

around config => sub {
    my $orig = shift;
    my $c = shift;

    croak('Setting config after setup has been run is not allowed.')
        if ( @_ and $c->setup_finished );

    $c->$orig(@_);
};


I understand the NOTE for Model/View/Controllers where the component's
__PACKAGE__->config is merged in with the application config for that
component.   Calling $self->config won't be the same thing passed to the
component's constructor.

But, what's the issue with calling $c->config( foo => 123 ) at runtime?
Or even $c->config( \%new_config )?

Note that wrapper only applies to calling config on the app class, and does
not apply to Model/View/Controllers.

Is there some other issues I'm missing?   What problem is that wrapper
trying to prevent?

Thanks,


-- 
Bill Moseley
[email protected]
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to