Introspector/Probe/Groups.pm

filter: Statementstmt 100% 20 / 20 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 93.7% 30 / 32 CC 4 SCAR 9.2
CC
4
Cov
96%
__ANON__
4.0
gather
1.0
BEGIN
1.0
CRAP 2.5
« Introspector/Config.pm ↑ Summary Introspector/Probe/Users.pm »
1 package System::Introspector::Probe::Groups;
2 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 1 ▶use System::Introspector::Util qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
5 handle_from_file
6 transform_exceptions
7 1 );
8  
9 1 ▶sub gather {
Subroutine gather: called CC=1 SCAR=0.0
Pod undocumented
10 1 my ($self) = @_;
11 1 ▶ return transform_exceptions {
Subroutine __ANON__: called CC=4 SCAR=13.9
12 1 my %group;
13 1 my $fh = $self->_open_group_file;
14 1 ▶ while (defined( my $line = <$fh> )) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $line = readline $fh)) 40 1 41
15 40 chomp $line;
16 40 ▶ next if !(length $line);
Branch: 1 branch
BranchTrueFalseTotal
unless length $line 0 40 40
17 40 my ($name, undef, $gid, $users) = split m{:}, $line;
18 40 ▶ $users = length($users)
Branch: 1 branch
BranchTrueFalseTotal
length $users ? : 9 31 40
19 ? [split m{,}, $users]
20 : [];
21 40 $group{ $name } = {
22 name => $name,
23 gid => $gid,
24 users => $users,
25 };
26 }
27 1 return { groups => \%group };
28 1 };
29 }
30  
31 1 ▶sub _open_group_file {
Subroutine _open_group_file: called CC=1 SCAR=0.0
32 1 my ($self) = @_;
33 1 return handle_from_file '/etc/group';
34 }
35  
36 1 1;
37  
38 __END__
« Introspector/Config.pm ↑ Summary Introspector/Probe/Users.pm »