my $count= int($c->request->params->{count}); $c->detach(HTTP => 422, ["Invalid count"]) if $count < 0 || $count > $limit;