CGI perl links to files in Dir
I'm in the middle of writing my first perl script.(had to happen sometime)
So far when i click submit the script makes an HTML page that has the same look as the rest of the pages on my site.
and thats pretty swell. Now i need to read the contents of a DIR
and make a link to each file in that DIR. I've been trying to implement
readdir(), but not having much luck. I will gladly affero pay someone for helping me out with this as soon as I get paid for the job.
this is the relevant part of the script so far:
-------code-------
find( sub
{
return if($_ =~ /^\./);
return unless($_ =~ /\$filetype/i);
stat $File::Find::name;
return if -d;
return unless -r;
opendir(DIR, $scandir) or return;
readdir(DIR);
my $file_name = $1;
closedir(DIR);
print "<li><a href=\"$File::Find::name\">$file_name</a></li>\n";
},
'$scandir');
-----end---code-----
$filetype is defined by a popup in the form (and working properly)
$scandir is defined at the head of the script
thanks alot(and yes i do know that i'm a hack)
Last edited by ocularbob; 04-28-2003 at 08:10 AM.
|