Sys::Filesystem::MountPoint - shortcuts to resolve paths and devices to mount points
use Sys::Filesystem::MountPoint ':all'; # BY PATH ------------------------- my $path_arg = '/home/renee/public_html/jeepers'; my $mount_point_result_a = path_to_mount_point( $path_arg ); is_mount_point( $mount_point_result_a ) or die("this should not happen"); # BY DEV ------------------------- my $dev_arg = '/dev/sdb1'; my $mount_point_result_b = dev_to_mount_point( $dev_arg ); is_mount_point( $mount_point_result_b ) or die("this should not happen"); if( $mount_point_result_b eq $mount_point_result_a ){ print "It appears $arg_path is in device $dev_arg\n" ."Because they both have mount point $mount_point_result_a\n"; }
What if you have a path of a file on disk, and you want to know what that file's mount point is? Or a device, and you want to resolve it? These are shortcuts to get that kind of info.
No subs are exported by default.
Argument is a path. Returns undef on fail. On success returns original argument.
Argument is a device path. Returns undef on fail. On success returns mount point.
Argument is a path on disk. Returns undef on fail. On success returns mount point.
Argument is a path, mount point, or device path, returns mount point. On fail returns undef.
If any of these subs fail, you may consult $errstr.
to_mount_point('/home/myself/misc') or die($Sys::Filesystem::MountPoint::errstr);
Sys::Filesystem
Leo Charre leocharre at cpan dot org
This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, i.e., under the terms of the "Artistic License" or the "GNU General Public License".
This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the "GNU General Public License" for more details.
To install Sys::Filesystem::MountPoint, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Sys::Filesystem::MountPoint
CPAN shell
perl -MCPAN -e shell install Sys::Filesystem::MountPoint
For more information on module installation, please visit the detailed CPAN module installation guide.