On 02/04/2013 09:13 AM, David Cantrell wrote:
On Sat, Feb 02, 2013 at 01:14:44PM -0500, yary wrote:

It would be nice to have something like $OSNAME for filesystem type
discovery... Beef up Sys::Filesystem and put it in the core? Or at least
encourage its use where helpful...

That's tricky.  What you're really interested in isn't the filesystem
but the filesystem's capabilities.  Consider, for example, NFS which
ends up on a FAT filesystem has different capabilities from NFS which
has an ext4 backend.  And in the general case you can't tell what those
capabilities are without just trying them.

So, riffing off of Devel::CheckOS, you'd want an API something like
this ...

my $fs = Devel::CheckFS->new($filename);

print "$filename is on an FS that is case sensitive\n"
   if($fs->supports('CaseSensitive'));

and because you want this to work on Windows as well as Unix, you need
to jump through all the painful hoops of making things like figuring out
what filesystem a file is on portable.

It's more like identifying the mountpoint per path,
and then retrieving the mount options per mount.
It has almost nothing to do with $^O.

I started refactoring File::Spec::case_tolerant to
take a mountpoint as optional argument for cygwin perl,
but there was never a reply on p5p.

--
Reini

Working towards a true Modern Perl.
Slim, functional, unbloated, compile-time optimizable

Reply via email to