G'day Rick,
As far as I can tell, Sys::Filesystem does not report what fstab file it uses.
It relies on the various Sys::Filesystem::<OS> modules, e.g. Sys::Filesystem::AIX, for the filesystem information.
See the "Sys-Filesystem distro page" for a list of those modules.
If you simply want to perform some upfront sanity checks, perhaps code similar to the following might suffice.
#!/usr/bin/env perl
use 5.010;
use strict;
use warnings;
use Sys::Filesystem ();
if (Sys::Filesystem::->supported()) {
my $fs = Sys::Filesystem::->new();
say '$Sys::Filesystem::FSTAB: ',
$Sys::Filesystem::FSTAB // 'undefined';
say '$fs->{fstab}: ', $fs->{fstab} // 'undefined';
say "O/S '$^O' supported.";
say 'Using: ', ref($fs->{filesystems});
my @fs_list = $fs->filesystems();
if (@fs_list) {
say 'Filesystems found:';
say "\t$_" for @fs_list;
}
else {
warn "No filesystems found.\n";
}
use Data::Dump;
say '=' x 60;
say 'Sys::Filesystem Object:';
say '=' x 60;
dd $fs;
say '-' x 60;
}
else {
warn "O/S '$^O' not supported.\n";
}
I've included code to produce a lot of additional information which you may find interesting,
but probably isn't wanted in production.
I'm strongly against breaking encapsulation and urge you to stick with the published API.
I only included $fs->{fstab} and $fs->{filesystems} for demonstration purposes.
I don't have any of the four OSes you list available at home.
Here's the output on my Cygwin system.
$Sys::Filesystem::FSTAB: undefined
$fs->{fstab}: undefined
O/S 'cygwin' supported.
Using: Sys::Filesystem::Cygwin
Filesystems found:
/
/cygdrive/c
/cygdrive/d
/usr/bin
/usr/lib
============================================================
Sys::Filesystem Object:
============================================================
bless({
aliases => {
boot_order => ["fs_mntno"],
check_frequency => ["fs_freq"],
check_order => ["fs_passno"],
device => ["fs_spec", "dev"],
filesystem => ["fs_file", "mount_point"],
format => ["fs_vfstype", "vfs", "vfstype"]
+,
label => ["fs_label"],
mount_point => ["fs_file", "filesystem"],
options => ["fs_mntops"],
type => ["fs_vfstype", "vfs"],
volume => ["fs_volume", "fs_vol", "vol"],
},
canondev => undef,
filesystems => bless({
"/" => {
device => "C:/cygwin64",
fs_file => "/",
fs_mntops => "binary,auto",
fs_spec => "C:/cygwin64",
fs_vfstype => "ntfs",
mount_point => "/",
mounted => 1,
},
"/cygdrive/c" => {
device => "C:",
fs_file => "/cygdrive/c",
fs_mntops => "binary,posix=0,user,noumount,auto
+",
fs_spec => "C:",
fs_vfstype => "ntfs",
mount_point => "/cygdrive/c",
mounted => 1,
},
"/cygdrive/d" => {
device => "D:",
fs_file => "/cygdrive/d",
fs_mntops => "binary,posix=0,user,noumount,auto
+",
fs_spec => "D:",
fs_vfstype => "ntfs",
mount_point => "/cygdrive/d",
mounted => 1,
},
"/usr/bin" => {
device => "C:/cygwin64/bin",
fs_file => "/usr/bin",
fs_mntops => "binary,auto",
fs_spec => "C:/cygwin64/bin",
fs_vfstype => "ntfs",
mount_point => "/usr/bin",
mounted => 1,
},
"/usr/lib" => {
device => "C:/cygwin64/lib",
fs_file => "/usr/lib",
fs_mntops => "binary,auto",
fs_spec => "C:/cygwin64/lib",
fs_vfstype => "ntfs",
mount_point => "/usr/lib",
mounted => 1,
},
}, "Sys::Filesystem::Cygwin"),
fstab => undef,
mtab => undef,
}, "Sys::Filesystem")
------------------------------------------------------------
|