* On Mon, Feb 23 2009, Jason Gottshall wrote:
> Oleg Pronin wrote:
>> I use many actions that take params from config in runtime, for example
>> sub pay_for_vip : Private {
>> ...
>> my $price = $c->cfg->{vip}{price};
>> }
>
> As I understand it, this is NOT the way config is intended to
> work. All the config for your component (controller in this case) is
> passed to the constructor at setup time; all you need to do is make
> accessors for whatever you want access to:
>
> __PACKAGE__->mk_accessors(qw/vip/);
>
> sub pay_for_vip : Private {
> ...
> my $price = $self->vip->{price};
> }
Yes, exactly.
This is another case of the all-too-frequent "change Catalyst so that I
won't have to change any code in my poorly-implemented app".
I don't think the patch will be harmful, though, so if there is one we
might as well apply it. But it's a lot easier to not misuse config than
it is to patch Catalyst to make the misuse faster.
Regards,
Jonathan Rockway
--
print just => another => perl => hacker => if $,=$"
_______________________________________________
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/