Apache will do the file listing for you if there is no DirectoryIndex in a publicly available directory.
If you want more control, I'd suggest glob. or File::Find to get the lists and File::Basename to guard against malicious input and dress up the text, as ++grep suggests. Here are some fragments to get you started:
Warning, this is off the top of my head. Mostly untested.# Specify what directory is meant by a tag. # Bogus tags will fail.to see anything undesirable my %dirs = ( foo => '/foo', bar => '/foo/bar', baz => '/quux', ); # restrict to html my @fles = glob $ENV{DOCUMENT_ROOT}.$dirs{$query->param('dire')}.'/*.h +tml'; # print GET urls for this script print join " / ", map {$query->a( { href=>$query->url() . "?dire=$_"}, $_)} keys % +dirs; # print file list use File::Basename; print map {$query->a({ href => $base_uri . substr( ($_, length( $ENV{DOCUMENT_ROOT} )) }, basename( $_, '.html') ) . $query->br() . "\n" } @fles;
After Compline,
Zaxo
In reply to Re: Abs directory turned into links
by Zaxo
in thread Abs directory turned into links
by einerwitzen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |