Help Needed for Web Based Directory Browser
am 23.07.2006 03:31:10 von fuzor_silverboltI'm currently working on a simple directory browser written in perl. It
works great on the "home" location but once I click on a link to goto
another directory it will not create hyperlinks to travel to another
directory. I tried this on both winXP/IIS and FreeBSD/Apache2. Any
ideas why this is happening would be appreciated.
#!/usr/bin/perl
use CGI;
$thisurl="dirtest.cgi";
$cgiquery = new CGI();
$choosedirectory=$cgiquery->param('choosedirectory');
print $cgiquery->header();
# Evaluate and Initialize PERL library Cwd
eval "use Cwd;";
if ($@) {&error("Cwd could not be located.");}
#Find the abs path to the current working dir.
use Cwd 'abs_path';
$abs_path = abs_path();
if (!$choosedirectory){
$dirtouse=$abs_path;
}else{
$dirtouse=$choosedirectory;
}
chdir $dirtouse;
opendir MYDIR, "$dirtouse";
@contents = readdir MYDIR;
closedir MYDIR;
print "
print "Current abspath: $abs_path , Current choosedirectory:
$choosedirectory , dirtouse: $dirtouse";
print "";