If, say, we want to do something else with the direct contents of the
directory, then it would be nice if this were easy. Pull the variable
declarations out, pull an initial priming call to `listdir' out, and
move the inner `listdir' to the end of the loop.
{ $tn{$f} = TrivGal::Image->new($path . $f->name)->scale($size); }
for my $d (@$dd) {
my $p = join_paths $path, $d->name;
{ $tn{$f} = TrivGal::Image->new($path . $f->name)->scale($size); }
for my $d (@$dd) {
my $p = join_paths $path, $d->name;
+ my ($ddd, $fff, $iii);
+ ($ddd, $fff, $iii) = listdir join_paths $IMGROOT, $p;
- my ($ddd, $fff, $iii) = listdir join_paths $IMGROOT, $p;
if (defined $iii) {
my $index = join_paths $p, $iii->name;
$tn{$d} = TrivGal::Image->new($index)->scale($size);
if (defined $iii) {
my $index = join_paths $p, $iii->name;
$tn{$d} = TrivGal::Image->new($index)->scale($size);
}
if (!@$ddd) { $tn{$d} = undef; last DIR; }
$p = join_paths $p, $ddd->[0]->name;
}
if (!@$ddd) { $tn{$d} = undef; last DIR; }
$p = join_paths $p, $ddd->[0]->name;
+ ($ddd, $fff, $iii) = listdir join_paths $IMGROOT, $p;