Directory index data for web server listings.
use WebServer::DirIndex;
my $di = WebServer::DirIndex->new(
dir => '/path/to/dir',
dir_url => '/some/dir/',
);
# Get the list of file entries
my @files = $di->files;
# Generate an HTML directory index page
my $html = $di->to_html('/some/dir/');
# Generate a prettified HTML directory index page
my $html = $di->to_html('/some/dir/', 1);This module reads a filesystem directory and builds the data required to render a directory index page for a web server. It provides access to the list of file entries and can generate an HTML page via WebServer::DirIndex::HTML.
The distribution includes four modules:
- WebServer::DirIndex — reads a directory and exposes file entries.
- WebServer::DirIndex::File - contains details of a single file in the directory.
- WebServer::DirIndex::HTML — renders the HTML directory index page.
- WebServer::DirIndex::CSS — provides standard and "pretty" CSS stylesheets.
perl Makefile.PL
make
make test
make install
This module is available on CPAN.
The code is available on GitHub.
For any questions, bug reports or suggestions, please use the issue tracker.
Dave Cross dave@perlhacks.com
Copyright (c) 2026 Magnum Solutions Limited. All rights reserved.
This is free software; you can redistribute it and/or modify it under the same terms as Perl itself.