We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e0afa09 commit bd5b030Copy full SHA for bd5b030
lib/Mojolicious/Guides/Cookbook.pod
@@ -1413,12 +1413,15 @@ to process requests in smaller batches.
1413
# Stop if there are no more URLs
1414
return unless my $url = shift @urls;
1415
1416
+ # Save __SUB__ for later use in another callback
1417
+ my $fetch = __SUB__;
1418
+
1419
# Fetch the next title
1420
$ua->get($url => sub ($ua, $tx) {
1421
say "$url: ", $tx->result->dom->at('title')->text;
1422
1423
# Next request
- __SUB__->();
1424
+ $fetch->();
1425
$promise->resolve if --$count == 0;
1426
});
1427
$count++;
0 commit comments