From 668fb7f74b25abf5b72cd61550ad9b64e8ab3ea8 Mon Sep 17 00:00:00 2001 From: Dimitar Petrov Date: Tue, 14 May 2013 12:23:40 +0200 Subject: [PATCH 1/2] Make detach_on_die default config option --- share/lib/MyApp.pm.tt | 1 + 1 file changed, 1 insertion(+) diff --git a/share/lib/MyApp.pm.tt b/share/lib/MyApp.pm.tt index c581743..65d1649 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 + detach_on_die => 1, ); # Start the application From 5b73aa35f601cc37d3454615aff647dfdd7fbfcb Mon Sep 17 00:00:00 2001 From: Dimitar Petrov Date: Fri, 24 May 2013 08:49:44 +0200 Subject: [PATCH 2/2] Better configuration key name --- share/lib/MyApp.pm.tt | 2 +- share/lib/MyApp/Controller/Root.pm.tt | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/share/lib/MyApp.pm.tt b/share/lib/MyApp.pm.tt index 65d1649..a54cd31 100644 --- a/share/lib/MyApp.pm.tt +++ b/share/lib/MyApp.pm.tt @@ -40,7 +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 - detach_on_die => 1, + 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);