[Catalyst] best practice for a protocol mechanism?

Zbigniew Lukasiak zzbbyy at gmail.com
Wed Sep 9 20:15:22 GMT 2009


On Tue, Sep 8, 2009 at 10:32 AM, Jens Schwarz<blacky6767 at gmx.de> wrote:
> Hi,
>
> I currently have an Catalyst application with several controllers and even more actions. Some of those actions require that I call my protocol action that - surprise, surprise - does some protocol work. This action is located in the Root controller. Right now I accomplish this with code snippets like this:
>
> package MyApp::Controller::Foo
> ...
> sub some_action :Local {
> ...
> $c->forward("MyApp::Controller::Root","myProtocolAction",["some message that should be protocolled"]);
> ...
> }
>
> Is there some neater way to do this? (I started reading into the "Chains" topic but do not know if this protocolling mechanismn would be the right use case for chaining.)

I am not entirely sure that I understand what you mean by protocol
action - but how about a plain old method call:

MyApp::Controller::Root->myProtocolAction( $c, "some message that
should be protocolled" );


-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
http://perlalchemy.blogspot.com/



More information about the Catalyst mailing list