Skip to content

Commit

Permalink
show a single non-blocking request too
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 10, 2016
1 parent 2195b07 commit fa8311b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/Mojo/UserAgent.pm
Expand Up @@ -378,7 +378,14 @@ Mojo::UserAgent - Non-blocking I/O HTTP and WebSocket user agent
->get('https://www.github.com/kraih/mojo/tarball/master')
->res->content->asset->move_to('/home/sri/mojo.tar.gz');
# Non-blocking concurrent requests
# Non-blocking request
$ua->get('mojolicious.org' => sub {
my ($ua, $tx) = @_;
say $tx->res->dom->at('title')->text;
});
Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
# Non-blocking concurrent requests (synchronized with a delay)
Mojo::IOLoop->delay(
sub {
my $delay = shift;
Expand Down

0 comments on commit fa8311b

Please sign in to comment.