Skip to content

Instantly share code, notes, and snippets.

@esobchenko
Last active December 10, 2015 00:38
Show Gist options
  • Select an option

  • Save esobchenko/4352482 to your computer and use it in GitHub Desktop.

Select an option

Save esobchenko/4352482 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use Mojolicious::Lite;
hook before_dispatch => sub {
my $self = shift;
$self->app->log->debug("entering 1st before dispatch hook...");
$self->render( text => "stop", status => 300 );
};
hook before_dispatch => sub {
my $self = shift;
$self->app->log->debug("entering 2nd before dispatch hook...");
};
hook after_dispatch => sub {
my $self = shift;
$self->app->log->debug("entering 1st after dispatch hook...");
};
hook after_dispatch => sub {
my $self = shift;
$self->app->log->debug("entering 2nd after dispatch hook...");
};
get '/' => sub {
my $self = shift;
$self->render(text => "foobar", status => 200);
};
app->start;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment