use AE;
my $app = sub {
return sub {
my $r = shift;
my $t; $t = AE::timer 60, 0, sub {
my $writer = $r->([200, ['Content-Type' => 'text/plain'] ]
+);
$writer->write('Hello World');
$writer->close;
undef $t;
};
};
};
Also, please note, that not all servers are AE-compatible, i.e. they could use own loop mechanism, and there will be a problem with AE; e.g. starman.
Another source of problem with fork: do not ever use any loop-related
code in child (directly or indirectly), i.e. do system/exec ASAP.
|