NAME
WebServer::DirIndex::HTML - HTML rendering for directory index pages
SYNOPSIS
use WebServer::DirIndex::HTML;
my $html = WebServer::DirIndex::HTML->new(
path_info => '/some/dir/',
files => \@files,
pretty => 0,
);
my $page = $html->render;
DESCRIPTION
This module renders an HTML directory index page from a list of file entries. It provides the HTML templates used to generate the page.
CONSTRUCTOR
- new(%args)
-
Creates a new
WebServer::DirIndex::HTMLobject. Accepts the following named parameters:- path_info
-
The request path info (e.g.
/some/dir/). Used as the page title and heading. - files
-
An arrayref of file entries. Each entry is an arrayref of
[$url, $name, $size, $type, $mtime]. - pretty
-
If true, uses an enhanced CSS stylesheet for a more attractive appearance. Defaults to false.
METHODS
- file_html
-
Returns a
sprintfformat string used to render a single file row. - dir_html
-
Returns a
sprintfformat string used to render the full directory index page. - render
-
Generates and returns the complete HTML directory index page.
AUTHOR
Dave Cross <dave@perlhacks.com>
COPYRIGHT
Copyright (c) 2026 Magnum Solutions Limited. All rights reserved.
LICENCE
This code is free software; you can redistribute it and/or modify it under the same terms as Perl itself.