Why do you need to read the content of a directory using
a db? It is possible to read directories using command
opendir:
opendir DIR, $dir;
while ($file = readdir DIR) {
if ($file =~ /\.jpg$/) {
push @images, { 'image' => $file };
}
}
closedir DIR;
I didn't understand what kind of drop-down thingy you
need :) drop-down menus? HTML? Tk? I know only some HTML and
here is what I would do using HTML::Template:
use HTML::Template;
$t = HTML::Template->new(filename => 'dropdown.tmpl');
$t->param(IMAGES => \@images);
print "Content-Type: text/html\n\n", $t->output;
Now, you need a template like this:
<form action="">
<select name="images">
<TMPL_LOOP IMAGES>
<option><TMPL_VAR image></option>
</TMPL_LOOP>
</form>
I think that these lines of code are enough to start
your work; the Monastery is full of this examples. Please
don't forget to begin your script with few magic words:
#!/usr/bin/perl -w
use strict;
use vars qw($my $vars $are $here);
Ciao, Valerio
Disclaimer: please note that this code
wasn't tested and is not approved by other monks.
|