NAME
Pcore::HTTP::Server
SYNOPSIS
my $svr = Pcore::HTTP::Server->new(
listen => '//127.0.0.1:80',
on_request => sub ($req) {
return 200, [ 'Content-Type' => 'text/html' ], 'body';
}
);
# asynchronous response
on_request => sub ($req) {
async {
$req->( 200, [ 'Content-Type' => 'text/html' ] );
$req->('data1');
$req->('data2');
$req->finish;
return;
};
return;
}