[Catalyst] Re: Private Chained Actions?

Marc Sebastian Pelzer marc at knusperfisch.de
Fri Jun 20 17:16:03 BST 2008


>> You need a screwdriver, not a hammer.
>
>    sub hello_setup : Private {
>      my ($self, $c) = @_
>      $c->stash->{setup} = 'done';
>    }
>
>    sub hello : Private {
>      my ($self, $c) = @_
>      $c->forward('hello_setup'); # <---------
>      $c->res->body('hello! setup is ' . $c->stash->{setup});
>    }
>
>    sub index : Path : Args(0) {
>      my ($self, $c) = @_
>      $c->detach('hello');
>    }


thanks for the hint. Thats what I'm doing right now. I thought that  
there may be a more elegant way of doing this. Especially for a longer/ 
more complex chained setup :) Also, doing it this way it does not look  
not too nice in the dispatcher path in the debug logfile - hello()  
comes before hello_setup() :-|

Thanks! Marc




More information about the Catalyst mailing list