Skip to content

Instantly share code, notes, and snippets.

@brianmed
Last active December 18, 2015 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianmed/5798975 to your computer and use it in GitHub Desktop.
Save brianmed/5798975 to your computer and use it in GitHub Desktop.
#!/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