Last active
December 18, 2015 14:39
-
-
Save brianmed/5798975 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/opt/perl | |
use Mojolicious::Lite; | |
get '/' => sub { | |
my $self = shift; | |
die("Here") if $self->param("exception"); | |
$self->render("slash"); | |
}; | |
hook around_dispatch => sub { | |
my ($next, $c) = @_; | |
eval { | |
$next->(); | |
}; | |
if ($@) { | |
$c->render("exception", msg => $@); | |
} | |
}; | |
app->start; | |
__DATA__ | |
@@ slash.html.ep | |
Hello world. | |
@@ exception.html.ep | |
It exploded. | |
<%= $msg %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment