--- /dev/null
+package System::Introspector::Groups;
+use Moo;
+
+sub gather {
+ my ($self) = @_;
+ my %group;
+ my $fh = $self->_open_group_file;
+ while (defined( my $line = <$fh> )) {
+ chomp $line;
+ my ($name, undef, $gid, $users) = split m{:}, $line;
+ $users = length($users)
+ ? [split m{,}, $users]
+ : [];
+ $group{ $gid } = {
+ name => $name,
+ gid => $gid,
+ users => $users,
+ };
+ }
+ return \%group;
+}
+
+sub _open_group_file {
+ my ($self) = @_;
+ open my $fh, '<', '/etc/group'
+ or die "Unable to read group file /etc/group: $!\n";
+ return $fh;
+}
+
+1;