Skip to content

Commit

Permalink
tweaked a few cookbook recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 27, 2012
1 parent 51eb284 commit 51d422f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion MANIFEST.SKIP
@@ -1,5 +1,5 @@
^\.(?!perltidyrc)
.*\.old$
^Makefile$
^blib
^pm_to_blib
^Makefile$
6 changes: 6 additions & 0 deletions lib/Mojolicious/Guides/Cookbook.pod
Expand Up @@ -243,6 +243,7 @@ You can also use the built-in web server to embed L<Mojolicious> applications
into alien environments like foreign event loops.

use Mojolicious::Lite;
use Mojo::IOLoop;
use Mojo::Server::Daemon;

# Normal action
Expand Down Expand Up @@ -301,6 +302,7 @@ Multiple events such as parallel requests can be easily synchronized with a
L<Mojo::IOLoop> delay.

use Mojolicious::Lite;
use Mojo::IOLoop;

# Search Twitter for "perl" and "python"
get '/' => sub {
Expand Down Expand Up @@ -336,6 +338,7 @@ for example be used to delay rendering of a response, and unlike C<sleep>,
won't block any other requests that might be processed in parallel.

use Mojolicious::Lite;
use Mojo::IOLoop;

# Wait 3 seconds before rendering a response
get '/' => sub {
Expand All @@ -351,6 +354,7 @@ Recurring timers are slightly more powerful, but need to be dropped manually,
or they would just keep getting emitted.

use Mojolicious::Lite;
use Mojo::IOLoop;

# Count to 5 in 1 second steps
get '/' => sub {
Expand Down Expand Up @@ -397,6 +401,7 @@ channels between clients and servers. Receiving messages is as easy as
subscribing to the C<message> event of the transaction.

use Mojolicious::Lite;
use Mojo::IOLoop;

# Template with browser-side code
get '/' => 'index';
Expand Down Expand Up @@ -480,6 +485,7 @@ the advantage however is low infrastructure requirements, since it reuses the
HTTP protocol for transport.

use Mojolicious::Lite;
use Mojo::IOLoop;

# Template with browser-side code
get '/' => 'index';
Expand Down

0 comments on commit 51d422f

Please sign in to comment.