AttributeSet helper: skip wantarray

This commit is contained in:
Graham Christensen 2021-10-20 12:52:34 -04:00
parent d2f03ca050
commit 30a7f068b7
2 changed files with 3 additions and 2 deletions

View file

@ -50,7 +50,7 @@ sub splitPath {
sub enumerate {
my ($self) = @_;
my @paths = sort { length($a) <=> length($b) } @{$self->{"paths"}};
return wantarray ? @paths : \@paths;
return @paths;
}
1;

View file

@ -31,8 +31,9 @@ $attrs->registerValue("foo");
$attrs->registerValue("bar.baz.tux");
$attrs->registerValue("bar.baz.bux.foo.bar.baz");
my @enumerated = $attrs->enumerate();
is(
\@{$attrs->enumerate()},
\@enumerated,
[
# "foo": skipped since we're registering values, and we
# only want to track nested attribute sets.