LasTres/lib/LasTres/Area.pm

27 lines
462 B
Perl

package LasTres::Area;
use v5.36.0;
use strict;
use warnings;
use feature 'signatures';
use Moo::Role;
requires qw/identifier locations name parent/;
has children => (
is => 'ro',
lazy => 1,
builder => \&_build_children,
);
sub _build_children($self) {
my $locations = $self->locations;
my @locations = map { $locations->{$_} } keys %$locations;
@locations = sort { $a->name cmp $b->name } @locations;
return \@locations;
}
1;