>>109782036
i wonder
sub load_users {
my ($fh, $wanted) = @_;
my %users;
while (<$fh>) {
next if /^\s*(?:#|$)/;
chomp;
my ($name, $flags, $email) = split /\s*:\s*/, $_, 3;
next unless defined $name && length $name;
next if $wanted && !grep { $_ eq $name } @$wanted;
$users{lc $name} = {
email => $email =~ s/^\s+|\s+$//gr,
active => $flags =~ /\bactive\b/i ? 1 : 0,
roles => [
map { lc }
grep { length }
split /,\s*/, $flags
],
};
}
return wantarray ? %users : \%users;
}