View difference between Paste ID: 50ewAcHW and LRcgSMgf
SHOW: | | - or go back to the newest paste.
1
# Render Status 404 not working from Other file route
2
# app.pl
3
use Mojolicious::Lite;
4
app->route('search/:by')->to('search#index');
5
app->start;
6
7
package Search;
8
sub index {
9
	my $self = shift;
10
	my $by   = $self->param('by');
11
	if ( $by eq 'model' ) { $text = "by model" }
12
	elsif ( $by eq 'price' ) { $text = "by price" }
13
	else { return $self->render( status => 404 ) }
14
	$self->render( text => $text );
15-
}
15+
}
16
17
=cut Log
18
19
[Thu Jan 26 09:47:32 2012] [debug] GET /search/test (Mozilla/5.0 (X11; Linux x86_64) AppleWebKi35.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7).
20
[Thu Jan 26 09:47:32 2012] [debug] Dispatching "Search->index".
21
[Thu Jan 26 09:47:32 2012] [debug] Template "search/index.html.ep" not found.
22
[Thu Jan 26 09:47:32 2012] [debug] Template "search/index.html.ep" not found.
23
[Thu Jan 26 09:47:32 2012] [debug] Nothing has been rendered, assuming delayed response.
24
[Thu Jan 26 09:47:47 2012] [error] Connection timeout.