-
-
Save jberger/38237c4a8d361feaa1be2e59060b4eda to your computer and use it in GitHub Desktop.
This file contains 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; | |
get '/' => sub { | |
my ( $c ) = @_; | |
$c->delay( | |
sub { | |
my ( $delay ) = @_; | |
say "Fetching Google"; | |
$delay->pass('google'); | |
$c->ua->get( 'http://google.com', $delay->begin ); | |
say "Fetching Yahoo"; | |
$delay->pass('yahoo'); | |
$c->ua->get( 'http://yahoo.com', $delay->begin ); | |
}, | |
sub { | |
my ( $delay, %args ) = @_; | |
# do something with transactions by name ... | |
}, | |
); | |
}; | |
app->start; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment