hook before => sub { if ($some_condition) { send_error("Not allowed", 403); } };