Skip to content

Instantly share code, notes, and snippets.

@kraih
Created June 2, 2011 10:08
Show Gist options
  • Save kraih/1004206 to your computer and use it in GitHub Desktop.
Save kraih/1004206 to your computer and use it in GitHub Desktop.
use Mojolicious::Lite;
get '/' => sub {
my $self = shift;
# Write two chunks right away
$self->write("first\n");
$self->write("second\n");
# Wait 3 seconds and write last chunk
Mojo::IOLoop->timer(3 => sub {
$self->finish("third\n");
});
};
app->start;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment