Leo Charre > Sys-Filesystem-MountPoint-1.02 > Sys::Filesystem::MountPoint

Download:
Sys-Filesystem-MountPoint-1.02.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  4
Open  0
View/Report Bugs
Module Version: 1.02   Source  

NAME ^

Sys::Filesystem::MountPoint - shortcuts to resolve paths and devices to mount points

SYNOPSIS ^

   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";
   }

DESCRIPTION ^

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.

SUBS ^

No subs are exported by default.

is_mount_point()

Argument is a path. Returns undef on fail. On success returns original argument.

dev_to_mount_point()

Argument is a device path. Returns undef on fail. On success returns mount point.

path_to_mount_point()

Argument is a path on disk. Returns undef on fail. On success returns mount point.

to_mount_point()

Argument is a path, mount point, or device path, returns mount point. On fail returns undef.

$errstr

If any of these subs fail, you may consult $errstr.

   to_mount_point('/home/myself/misc') 
      or die($Sys::Filesystem::MountPoint::errstr);

SEE ALSO ^

Sys::Filesystem

CAVEATS ^

AUTHOR ^

Leo Charre leocharre at cpan dot org

LICENSE ^

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".

DISCLAIMER ^

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.

syntax highlighting: