Skip to content

Mojolicious and anyevent

kraih edited this page Jul 27, 2011 · 6 revisions

Mojolicious and AnyEvent

AnyEvent works with Mojolicious out of the box, as long as you have the EV module installed.

#!/usr/bin/env perl
use Mojolicious::Lite;
use EV;
use AnyEvent;

# Simple delayed rendering
get '/' => sub {
  my $self = shift;
  my $w;
  $w = AE::timer 3, 0, sub {
    $self->render_text('3 seconds delayed!');
    undef $w;
  };
};

app->start;
Clone this wiki locally