Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
more user agent examples
  • Loading branch information
kraih committed Jul 1, 2014
1 parent 9b7836a commit 47819c7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Changes
@@ -1,5 +1,5 @@

5.11 2014-06-30
5.11 2014-07-01
- Improved error method in Mojolicious::Validator::Validation to return
field names when called without arguments.

Expand Down
14 changes: 14 additions & 0 deletions lib/Mojo.pm
Expand Up @@ -130,6 +130,20 @@ L<Mojo::UserAgent> object.
# Perform blocking request
say $app->ua->get('example.com')->res->body;
# Perform concurrent non-blocking requests
Mojo::IOLoop->delay(
sub {
my $delay = shift;
$app->ua->get('http://example.com' => $delay->begin);
$app->ua->get('https://example.com' => $delay->begin);
},
sub {
my ($delay, $first, $second) = @_;
say $first->res->body;
say $second->res->body;
}
)->wait;
=head1 METHODS
L<Mojo> inherits all methods from L<Mojo::Base> and implements the following
Expand Down
6 changes: 0 additions & 6 deletions lib/Mojo/IOLoop/Delay.pm
Expand Up @@ -259,12 +259,6 @@ not increment the active event counter or an error occurs in a callback.
Start L</"ioloop"> and stop it again once an L</"error"> or L</"finish"> event
gets emitted, does nothing when L</"ioloop"> is already running.
# Use a single step to synchronize portably
$delay->steps(sub {
my ($delay, @args) = @_;
...
})->wait;
=head1 SEE ALSO
L<Mojolicious>, L<Mojolicious::Guides>, L<http://mojolicio.us>.
Expand Down

0 comments on commit 47819c7

Please sign in to comment.