Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#!/usr/bin/perl
use strict;
use warnings;
use Mojo::Client;
my $client = Mojo::Client->new;
my $child = Mojo::Client->new;
for my $q (0 .. 10) {
$client->get(
'http://google.com/?q=' . $q => sub {
my ($cli, $tx) = @_;
warn "Parent got " . $tx->req->url . "\n";
# How to make this subrequest non-blocking?
$child->get(
'http://finance.ua/?q=' . $tx->req->url => sub {
my ($cli, $tx) = @_;
warn "Child got " . $tx->req->url . "\n";
}
)->start;
}
);
}
$client->start;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment