diff --git a/share/lib/MyApp.pm.tt b/share/lib/MyApp.pm.tt index c581743..a54cd31 100644 --- a/share/lib/MyApp.pm.tt +++ b/share/lib/MyApp.pm.tt @@ -40,6 +40,7 @@ __PACKAGE__->config( # Disable deprecated behavior needed by old applications disable_component_resolution_regex_fallback => 1, enable_catalyst_header => 1, # Send X-Catalyst header + abort_chain_on_error_fix => 1, # Break a chain if error occurs ); # Start the application diff --git a/share/lib/MyApp/Controller/Root.pm.tt b/share/lib/MyApp/Controller/Root.pm.tt index e911ca8..14fd96d 100644 --- a/share/lib/MyApp/Controller/Root.pm.tt +++ b/share/lib/MyApp/Controller/Root.pm.tt @@ -35,11 +35,22 @@ sub index :Path :Args(0) { =head2 default -Standard 404 error page +Default handler if no action is matched =cut sub default :Path { + my ( $self, $c ) = @_; + $c->detach('/not_found'); +} + +=head2 not_found + +Standard 404 error page + +=cut + +sub not_found: Private { my ( $self, $c ) = @_; $c->response->body( 'Page not found' ); $c->response->status(404);