Directory listings over HTTP

Recently, a co-worker chided me about there being no apparent quick & easy utilities for Perl that served a directory listing over HTTP; specifically, something that matched the functionality of:

python -m SimpleHTTPServer

I perused CPAN, but found only modules that could be used to create a utility.

A couple of vim-strokes there is App::dirserve. Suggestions for a better name are welcome.

It uses Mojolicious' development daemon for the work, and as such has one pre-requisite. It has a bit more functionality that the python solution, and more importantly, css gradients make it much prettier.

usage: dirserve [OPTIONS]

These options are available:
--directory Directory to serve. Defaults to current directory.
--index-page Page to show by default. Defaults to directory listing.
--port Port to serve on. Defaults to 3000.
--no-dots No navigating to parent directories via '..'.
--help This message.

Source, installation, & screenshot:


plackup -MPlack::App::Directory -e'Plack::App::Directory->new->to_app'

I wonder if miyagawa would accept an extension to plackup that would do the right thing when called with just a perl module name:

plackup -mPlack::App::Directory

Leave a comment

About tempire

user-pic I do not like the status quo. There is always a better way; the question is whether you care enough to find it.