package MyApp::Web::Dispatcher; use strict; use warnings; use Malts::Web::Router::Simple; get '/' => ['Root#auth' => 'Root#index']; 1;
package MyApp::Web::Controller::Root; use strict; use warnings; sub auth { my ($self, $c) = @_; return $c->render_string(403, 'fuck') if !$c->req->header('X-ChinChin'); } sub index { my ($self, $c) = @_; $c->render_string(200, 'ok!'); } 1;
というのが出来るようになりました。
前から順番にactionを実行していき、どこぞのactionでレスポンスオブジェクトが返ってきた時点で次のactionは実行されなくなる仕様でございます。すべてのactionがレスポンスオブジェクトを返してこなければデフォルトでは404が返ります。
Maltsは、actionがレスポンスオブジェクトを返すという仕様になっておるので、そこまでわかりにくくないと思った次第。