notes.jays.net

A better Catalyst Controller block

Originally posted to deafferret on 2012-06-14.

So, stick this in your pipe and smoke it:

sub some_catalyst_action :Local { my( $self , $c ) = @; try { my $validated_params = validate_request_params( $c->request->params ); my $step_one_result = $c->model(BusinessLogic)->do_step_one( $session , $validated_params ); my $step_two_result = $c->model(BusinessLogic)->do_step_two( $step_one_result, $session ); } catch { $c->detach( error , [ $ ] ) }; } }