| 1 | package System::Introspector::Probe::MountPoints; | ||||||||||||||||||||||||||||
| 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 | return { | ||||||||||||||||||||||||||||
| 12 | 1 | ▶ | mtab => transform_exceptions { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 1 | return { entries | |||||||||||||||||||||||||||
| 14 | => $self->_parse_tab_fh($self->_open_fh('/etc/mtab')) }; | ||||||||||||||||||||||||||||
| 15 | }, | ||||||||||||||||||||||||||||
| 16 | 1 | ▶ | fstab => transform_exceptions { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 1 | return { entries | |||||||||||||||||||||||||||
| 18 | => $self->_parse_tab_fh($self->_open_fh('/etc/fstab')) }; | ||||||||||||||||||||||||||||
| 19 | }, | ||||||||||||||||||||||||||||
| 20 | 1 | }; | |||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 2 | ▶ | sub _open_fh { | ||||||||||||||||||||||||||
|
Subroutine
_open_fh: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | 2 | my ($self, $file) = @_; | |||||||||||||||||||||||||||
| 25 | 2 | return handle_from_file $file; | |||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 2 | ▶ | sub _parse_tab_fh { | ||||||||||||||||||||||||||
|
Subroutine
_parse_tab_fh: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||
| 29 | 2 | my ($self, $fh) = @_; | |||||||||||||||||||||||||||
| 30 | 2 | my @mounts; | |||||||||||||||||||||||||||
| 31 | 2 | ▶ | while (defined( my $line = <$fh> )) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 32 | 25 | chomp $line; | |||||||||||||||||||||||||||
| 33 | 25 | ▶ | next if $line =~ m{^\s*$} | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$line =~ /^\s*$/ or $line =~ /^\s*#/
MC/DC50%1/2
$line =~ /^\s*$/ or $line =~ /^\s*#/
$line =~ /^\s*$/
$line =~ /^\s*#/
Truth table66%2/3
A or B
A= $line =~ /^\s*$/B= $line =~ /^\s*#/
| |||||||||||||||||||||||||||||
| 34 | or $line =~ m{^\s*#}; | ||||||||||||||||||||||||||||
| 35 | 24 | my ($device, $point, $type, $opt, $dump, $pass) | |||||||||||||||||||||||||||
| 36 | = split m{\s+}, $line; | ||||||||||||||||||||||||||||
| 37 | push @mounts, { | ||||||||||||||||||||||||||||
| 38 | device_name => $device, | ||||||||||||||||||||||||||||
| 39 | mount_point => $point, | ||||||||||||||||||||||||||||
| 40 | fs_type => $type, | ||||||||||||||||||||||||||||
| 41 | dump_freq => $dump, | ||||||||||||||||||||||||||||
| 42 | pass_num => $pass, | ||||||||||||||||||||||||||||
| 43 | options => { | ||||||||||||||||||||||||||||
| 44 | map { | ||||||||||||||||||||||||||||
| 45 | 24 | my ($name, $value) = split m{=}, $_, 2; | |||||||||||||||||||||||||||
| 46 | 124 | ▶ | $value = 1 | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | unless defined $value; | ||||||||||||||||||||||||||||
| 48 | 124 | ($name => $value); | |||||||||||||||||||||||||||
| 49 | } split m{,}, $opt, | ||||||||||||||||||||||||||||
| 50 | }, | ||||||||||||||||||||||||||||
| 51 | }; | ||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | 1 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 54 | return [ sort { | ||||||||||||||||||||||||||||
| 55 | 2 | ($a->{device_name} cmp $b->{device_name}) | |||||||||||||||||||||||||||
| 56 | || | ||||||||||||||||||||||||||||
| 57 | ($a->{mount_point} cmp $b->{mount_point}) | ||||||||||||||||||||||||||||
| 58 | 71 | ▶ | } @mounts ]; | ||||||||||||||||||||||||||
|
Condition66%2/3
$System::Introspector::Probe::MountPoints::a->{'device_name'} cmp $System::Introspector::Probe::MountPoints::b->{'device_name'} || $System::Introspector::Probe::MountPoints::a->{'mount_point'} cmp $System::Introspector::Probe::MountPoints::b->{'mount_point'}
MC/DC0%0/2
$System::Introspector::Probe::MountPoints::a->{'device_name'} cmp $System::Introspector::Probe::MountPoints::b->{'device_name'} || $System::Introspector::Probe::MountPoints::a->{'mount_point'} cmp $System::Introspector::Probe::MountPoints::b->{'mount_point'}
$System::Introspector::Probe::MountPoints::a->{'device_name'} cmp $System::Introspector::Probe::MountPoints::b->{'device_name'}
$System::Introspector::Probe::MountPoints::a->{'mount_point'} cmp $System::Introspector::Probe::MountPoints::b->{'mount_point'}
Truth table66%2/3
A || B
A= $System::Introspector::Probe::MountPoints::a->{'device_name'} cmp $System::Introspector::Probe::MountPoints::b->{'device_name'}B= $System::Introspector::Probe::MountPoints::a->{'mount_point'} cmp $System::Introspector::Probe::MountPoints::b->{'mount_point'}
| |||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 1 | 1; | |||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | __END__ | ||||||||||||||||||||||||||||