[Catalyst] Maybe there is a need for some speedups of 'config' method ?

Jason Gottshall jgottshall at capwiz.com
Mon Feb 23 18:04:34 GMT 2009


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};
   }

-- 
Jason Gottshall
jgottshall at capwiz.com




More information about the Catalyst mailing list