Sloop is a single thread asynchronous, linux (epoll) based HTTP 1.1 server with a perl interface. It was written in C and perl and has an event driven API.
#!/usr/bin/perl use strict; use warnings; use Sloop::Server; my $Sloop = Sloop::Server->new(); my $page = <<END; <!DOCTYPE html> <html> <body> <h1>Hello World</h1> </body> </html> END $Sloop->{handlers} = { '/' => sub { my $client = shift; $client->reply(\$page); } }; $Sloop->run();
Requests are handled by cascading through the handlers
hash. Some other features:
- HTTPS via GnuTLS.
- IPv6 capable.
- Supports request pipelining.
- Name based virtual hosting.
- Direct handling and indexing of static pages and directory trees.
- Caching of dynamic pages.
- Unified logging with debugging options.
- Easy multipart uploads.
- Built-in WebSockets.
- Integrated cookie handling and session management.
- Simple generic responses based on status code.
- Connecting to other TCP servers as a client within the same event loop as front-side requests are handled.