Skip to content

Commit

Permalink
more links in cookbook
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Sep 21, 2013
1 parent 6be09e7 commit efad127
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions lib/Mojo/IOLoop.pm
Expand Up @@ -495,6 +495,11 @@ Check if event loop is running.
Run event loop until an event occurs. Note that this method can recurse back
into the reactor, so you need to be careful.
# Don't block longer than 0.5 seconds
my $id = Mojo::IOLoop->timer(0.5 => sub {});
Mojo::IOLoop->one_tick;
Mojo::IOLoop->remove($id);
=head2 recurring
my $id = Mojo::IOLoop->recurring(0.5 => sub {...});
Expand Down
7 changes: 4 additions & 3 deletions lib/Mojolicious/Guides/Cookbook.pod
Expand Up @@ -293,7 +293,7 @@ deployment location of your application.

From time to time you might want to reuse parts of L<Mojolicious> applications
like configuration files, database connection or helpers for other scripts,
with this little mock server you can just embed them.
with this little L<Mojo::Server> based mock server you can just embed them.

use Mojo::Server;

Expand All @@ -308,8 +308,9 @@ with this little mock server you can just embed them.

=head2 Web server embedding

You can also use the built-in web server to embed L<Mojolicious> applications
into alien environments like foreign event loops.
You can also use L<Mojo::IOLoop/"one_tick"> to embed the built-in web server
L<Mojo::Server::Daemon> into alien environments like foreign event loops that
for some reason can't just be integrated with a new reactor backend.

use Mojolicious::Lite;
use Mojo::IOLoop;
Expand Down

0 comments on commit efad127

Please sign in to comment.