···
37
-
my ($fn) = @_; local $/ = undef;
38
-
open FILE, "<$fn" or return undef; my $s = <FILE>; close FILE;
39
-
local $/ = "\n"; chomp $s; return $s;
38
+
# enable slurp mode: read entire file in one go
40
+
open my $fh, "<$fn" or return undef;
43
+
# disable slurp mode
44
-
open FILE, ">$fn" or die "cannot create $fn: $!\n";
45
-
print FILE $s or die;
51
+
open my $fh, ">$fn" or die "cannot create $fn: $!\n";
52
+
print $fh $s or die "cannot write to $fn: $!\n";
53
+
close $fh or die "cannot close $fn: $!\n";
51
-
open FILE, "$cmd 2>/dev/null |" or die "Failed to execute: $cmd\n";
57
+
open(my $fh, "-|", @_) or die "Failed to execute: $@_\n";
58
+
my @ret = $fh->getlines();
···
$search = $types{$fsIdentifier} . ' ';
# Based on the type pull in the identifier from the system
203
-
my ($status, @devInfo) = runCommand("@utillinux@/bin/blkid -o export @{[$fs->device]}");
209
+
my ($status, @devInfo) = runCommand("@utillinux@/bin/blkid", "-o", "export", @{[$fs->device]});
die "Failed to get blkid info (returned $status) for @{[$fs->mount]} on @{[$fs->device]}";
···
# BTRFS is a special case in that we need to fix the referrenced path based on subvolumes
if ($fs->type eq 'btrfs') {
216
-
my ($status, @id_info) = runCommand("@btrfsprogs@/bin/btrfs subvol show @{[$fs->mount]}");
222
+
my ($status, @id_info) = runCommand("@btrfsprogs@/bin/btrfs", "subvol", "show", @{[$fs->mount]});
die "Failed to retrieve subvolume info for @{[$fs->mount]}\n";
···
die "Btrfs subvol name for @{[$fs->device]} listed multiple times in mount\n"
224
-
my ($status, @path_info) = runCommand("@btrfsprogs@/bin/btrfs subvol list @{[$fs->mount]}");
230
+
my ($status, @path_info) = runCommand("@btrfsprogs@/bin/btrfs", "subvol", "list", @{[$fs->mount]});
die "Failed to find @{[$fs->mount]} subvolume id from btrfs\n";