Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
slightly better event loop embedding example
  • Loading branch information
kraih committed Feb 17, 2012
1 parent cc91406 commit 3214aa3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/Mojolicious/Guides/Cookbook.pod
Expand Up @@ -246,10 +246,7 @@ into alien environments like foreign event loops.
use Mojo::Server::Daemon;

# Normal action
get '/' => sub {
my $self = shift;
$self->render(text => 'Hello World!');
};
get '/' => {text => 'Hello World!'};

# Connect application with web server and start accepting connections
my $daemon =
Expand Down Expand Up @@ -636,12 +633,15 @@ application.
use EV;
use AnyEvent;

# Normal action
get '/' => {text => 'Hello World!'};

# Start web server and let AnyEvent take control
# Connect application with web server and start accepting connections
my $daemon =
Mojo::Server::Daemon->new(app => app, listen => ['http://*:8080']);
$daemon->start;

# Let AnyEvent take control
AE::cv->recv;

=head1 USER AGENT
Expand Down

0 comments on commit 3214aa3

Please sign in to comment.