#! perl use AnyEvent::HTTPD; my $httpd = AnyEvent::HTTPD->new (port => 9090); warn "AnyEvent::HTTPD listening on: http://localhost:9090/\n"; $httpd->reg_cb ( '/' => sub { my ($httpd, $req) = @_; my $res = "

files embedded in this staticperl

"; my %size; $size{$_} = length static::find $_ for static::list; $res .= "
by nameby size
"; for (sort keys %size) { $res .= "$_ $size{$_}
"; } $res .= "
"; for (sort { $size{$b} <=> $size{$a} or $a cmp $b } keys %size) { $res .= "$size{$_} $_
"; } $res .= "
"; $req->respond ([200 => "OK", { 'Content-Type' => 'text/html' }, $res]); }, '' => sub { my ($httpd, $req) = @_; my $file = static::find substr $req->url, 1; $req->respond ([200 => "OK", { 'Content-Type' => 'text/plain; charset=utf-8' }, $file]); }, ); $httpd->run;