Created
July 11, 2013 07:38
-
-
Save ian-kent/5973339 to your computer and use it in GitHub Desktop.
Mojolicious lite app which blocks
This file contains hidden or 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
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