NAME

AnyEvent::Mojo - Start async Mojo servers easly

VERSION

Version 0.6

SYNOPSIS

use strict;
use warnings;
use AnyEvent;
use AnyEvent::Mojo;

my $port = 7865;

my $server = mojo_server undef, $port, sub {
  my ($self, $tx) = @_;
  
  # Handle the request here, see AnyEvent::Mojo::Server for details
};
    
# Run the loop
$server->run

# ... or ...
AnyEvent->condvar->recv;

STATUS

This is a first beta release. The interface should not change in a backwards incompatible way until version 1.0.

DESCRIPTION

This module allows you to integrate Mojo applications with the AnyEvent framework. For example, you can run a web interface for a long-lived AnyEvent daemon.

FUNCTIONS

The module exports the following functions:

mojo_server

Starts a server. Accepts three parameters:

host

The hostname or IP address to which the server will bind to. Use undef to bind to all interfaces.

port

Port where the server will listen on. You can use undef to choose the default value of 3000.

cb

A coderef. This handler will be called for each request. The first parameter is the server object, and the second is a Mojo::Transaction.

Returns a AnyEvent::Mojo::Server object.

AUTHOR

Pedro Melo, <melo at cpan.org>

CREDITS

In alphabetical order:

Lars Balker Rasmussen

Sebastian Riedel

COPYRIGHT & LICENSE

Copyright 2008 Pedro Melo.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.