[ABE.pm] quick and dirty webapp?
Ricardo SIGNES
rjbs-perl-abe at lists.manxome.org
Fri May 18 18:29:13 PDT 2007
* "Faber J. Fedor" <faber at linuxnj.com> [2007-05-18T17:08:41]
> have multiple directories that contain various files (mostly PDFs). My
> client would like to access these files via the web browser. I was
> thinking of just directory listings, but he want's pull down menus;
> instead of going to the QA reports directory, he wants to click on the
> Intranet tab, select QA, then Reports, then the YYYYMMDD and see the PDF
> (_in_ his browser?). I imagine the webapp would have to read the dir and
> parse the dir/file names before showing the menus.
How do you know what file is what date? Let's say that the directories are
random and the filenames are YYYY-MM-DD.PDF
sub filename_to_date {
my ($filename) = @_;
(my $date = $filename) =~ s{.+[\\/]}{};
$date =~ s/-//i;
$date =~ s/\.pdf//i;
return $date;
}
my @files = File::Find::Rule->file->name(qr/\.pdf$/i)->in('root_dir');
my %date = map { $_ => filename_to_date($_) } @files;
print "<form><select name='filename'>";
print "<option value='$_'>$date{$_}</option>\n" for keys %date;
print "</select></form>";
...and then something that redirects to the submitted file.
> Anyone know of a quick and dirty way to do this? Or a better way? Would
> RoR be a good choice? I'm under the impression that RoR is best for
> small database-backed sites.
RoR would be MASSIVE overkill.
--
rjbs
More information about the ABE-pm
mailing list