helloworld.pl

#!/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);
	},
	banana => sub {
		my $client = shift;
		$client->generic(500);
	}
};

$Sloop->run();