package MyApp::Controller::WhatEver; use warnings; use strict; use parent "Catalyst::Controller"; use Date::Calc "check_date"; sub by_date : Path("d") Args(3) { my ( $self, $c, $yyyy, $mm, $dd ) = @_; $c->detach( YOUR_404_HANDLER ) unless eval { check_date($yyyy,$mm,$dd) }; my $some_rs = $c->model("Your::Schema")->search({ ...use dates... }); $some_rs->count || $c->detach( YOUR_404_HANDLER ); }