Thx, hippo, this syntax gets us started
my @children = $pt->children;
, but it seems to draw me away from Path::Tiny because @children appears to be a bunch of strings. (Progress is having them all there, so yay that.)
children are /home/bob/2.scripts/pages/7.cw/template_stuff/crosswords/caption_filled.gif /home/bob/2.scripts/pages/7.cw/template_stuff/crosswords/за
ва /home/bob/2.scripts/pages/7.cw/template_stuff/crosswords/изобажение /home/bob/2.scripts/pages/7.cw/template_stuff/crosswords/подписи /home/bob/2.scripts/pages/7.cw/template_stuff/crosswords/eugene
dyetya is /home/bob/2.scripts/pages/7.cw/template_stuff/crosswords/caption_filled.gif
dyetya is /home/bob/2.scripts/pages/7.cw/template_stuff/crosswords/захват
Can't locate object method "basename" via package "/home/bob/2.scripts/pages/7.cw/template_stuff/crosswords/захват" (perhaps you forgot to load "/home/bob/2.scripts/pages/7.cw/template_stuff/crosswords/захват"?) at ./7.cw2.pl line 83.
$
I suppose one could pull out File::Basename, but that's a module I'm trying to abrogate.
my @children = $vars{cw}->children;
say "children are @children";
foreach my $child (@children) {
$child = decode( 'UTF-8', $child );
say "dyetya is $child";
next unless -d $child;
my $base_dir = $child->basename;
say "base dir is $base_dir";
$vars{$base_dir} = path($child);
say "dir is $vars{$base_dir}";
}
Update:
I believe that the Path::Tiny way to do this is using the iterator method:
my $iter = $vars{cw}->iterator;
while ( my $next = $iter->() ) {
say "next is $next";
my $next_decode = decode( 'UTF-8', $next );
my $base = $next->basename();
say "base is $base";
my $base_decode = decode( 'UTF-8', $base );
say "next decode is $next_decode";
say "base decode is $base_decode";
}
next is /home/bob/2.scripts/pages/7.cw/template_stuff/crosswords/изобажение
base is изобажение
next decode is /home/bob/2.scripts/pages/7.cw/template_stuff/crosswords/изображение
base decode is изображение