Skip to content

Instantly share code, notes, and snippets.

@ian-kent
Created July 11, 2013 07:38
Show Gist options
  • Save ian-kent/5973339 to your computer and use it in GitHub Desktop.
Save ian-kent/5973339 to your computer and use it in GitHub Desktop.
Mojolicious lite app which blocks
use Mojolicious::Lite;
use EV;
use AnyEvent;
hook after_build_tx => sub {
print "AFTER BUILD TX\n";
};
get '/' => sub {
my $self = shift;
my $w;
print "START\n";
$w = AE::timer 5, 0, sub {
$self->render(text => 'Delayed by 5 seconds!');
undef $w;
print "END\n";
};
};
get '/other' => sub {
my $self = shift;
my $w;
print "START OTHER\n";
$w = AE::timer 5, 0, sub {
$self->render(text => 'Delayed by 5 seconds!');
undef $w;
print "END OTHER\n";
};
};
app->start;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment