Data-Hierarchy
view release on metacpan or search on metacpan
Hierarchy.pm view on Meta::CPAN
sub _ancestors {
my ($self, $hash, $path) = @_;
my @ancestors;
push @ancestors, '' if exists $hash->{''};
# Special case the root.
return @ancestors if $path eq '';
my @parts = split m{\Q$self->{sep}}, $path;
# Remove empty string at the front.
my $current = '';
unless (length $parts[0]) {
shift @parts;
$current .= $self->{sep};
}
for my $part (@parts) {
$current .= $part;
push @ancestors, $current if exists $hash->{$current};
( run in 2.394 seconds using v1.01-cache-2.11-cpan-71847e10f99 )