[Catalyst] Catalyst action attributes

Tomas Doran bobtfish at bobtfish.net
Mon Jul 13 08:32:07 GMT 2009


On 13 Jul 2009, at 07:50, Toby Corkindale wrote:

> Devin Austin wrote:
>> Check this out: http://search.cpan.org/~hkclark/Catalyst- 
>> Manual-5.8000/lib/Catalyst/Manual/ExtendingCatalyst.pod#Attributes  
>> and http://search.cpan.org/~hkclark/Catalyst-Manual-5.8000/lib/ 
>> Catalyst/Manual/ExtendingCatalyst.pod#Action_classes
>
> Thanks, although I had already read that before posting.
>
> As far as I can see, there is no way to pass parameters to the  
> ActionClass. Have I missed something?

The action class is passed the attributes when it is constructed in  
its arguments.

However - before we get into this, I recommend you write an  
ActionRole (ala Catalyst::Controller::ActionRole) instead of an  
action class, as you can use multiple actionroles together (which is  
not the case with action classes).

Simple example of some prior art you can steal to get you going:

http://search.cpan.org/~bobtfish/Catalyst-ActionRole- 
FindViewByIsa-0.000002/lib/Catalyst/ActionRole/FindViewByIsa.pm

Cheers
t0m




More information about the Catalyst mailing list