GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  ANYEVENT::MOJO (3)

.ds Aq ’

NAME

AnyEvent::Mojo - Start async Mojo servers easly

CONTENTS

VERSION

version 0.8003

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
    };
   
    # or...

    my $server = mojo_server {
      host       => 127.0.0.1,
      port       => $port,
      handler_cb => 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 <B>betaB> release. The interface <B>should notB> 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.
Alternatively you can pass a hash or hashref with all the options that will be passed along to AnyEvent::Mojo::Server constructor.

Returns a AnyEvent::Mojo::Server object.

SEE ALSO

AnyEvent::Mojo::Server, Mojo, and AnyEvent.

AUTHOR

Pedro Melo, <melo at cpan.org>

CREDITS

In alphabetical order:

Lars Balker Rasmussen

Sebastian Riedel

COPYRIGHT & LICENSE

Copyright 2008-2009 Pedro Melo.

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

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 ANYEVENT::MOJO (3) 2009-10-10

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.