Filesys::POSIX::Userland::Test - Inode conditional tests
use Filesys::POSIX; use Filesys::POSIX::Mem; my $fs = Filesys::POSIX->new(Filesys::POSIX::Real->new, 'noatime' => 1 ); $fs->import_module('Filesys::POSIX::Userland::Test'); $fs->touch('foo'); $fs->is_file('foo'); # returns 1 $fs->is_dir('foo'); # returns 0
This runtime addon module provides a series of boolean tests in the vein of test(1) that allow introspection of the nature of files without explicitly having to write boilerplate wrappers around $fs->stat.
$fs->stat
This module exposes the inode-level tests in the Filesys::POSIX::Inode base class at a higher, file-oriented level.
$FS->exists($path)
Returns true if an inode indicated by $path exists.
$path
$fs->is_file($path)
Returns true if an inode indicated by $path exists and is a regular file ($S_IFREG).
$S_IFREG
$fs->is_dir($path)
Returns true if an inode indicated by $path exists and is a directory ($S_IFDIR).
$S_IFDIR
$fs->is_link($path)
Returns true if an inode indicated by $path exists and is a symlink ($S_IFLNK).
$S_IFLNK
$fs->is_char($path)
Returns true if an inode indicated by $path exists and is a character device ($S_IFCHR).
$S_IFCHR
$fs->is_block($path)
Returns true if an inode indicated by $path exists and is a block device ($S_IFBLK).
$S_IFBLK
$fs->is_fifo($path)
Returns true if an inode indicated by $path exists and is a FIFO ($S_IFIFO).
$S_IFIFO
$fs->is_readable($path)
Returns true if an inode indicated by $path exists and has a readable bit set in the inode mode permissions field ($S_IRUSR | $S_IRGRP | $S_IROTH).
$S_IRUSR | $S_IRGRP | $S_IROTH
$fs->is_writable($path)
Returns true if an inode indicated by $path exists and has a writable bit set in the inode mode permissions field ($S_IWUSR | $S_IWGRP | $S_IWOTH).
$S_IWUSR | $S_IWGRP | $S_IWOTH
$fs->is_executable($path)
Returns true if an inode indicated by $path exists and has an executable bit set in the inode mode permissions field ($S_IXUSR | $S_IXGRP | $S_IXOTH).
$S_IXUSR | $S_IXGRP | $S_IXOTH
$fs->is_setuid($path)
Returns true if an inode indicated by $path exists and has a setuid bit set in the inode mode permissions field ($S_SUID).
$S_SUID
$fs->is_setgid($path)
Returns true if an inode indicated by $path exists and has a setgid bit set in the inode permissions field ($S_SGID).
$S_SGID
To install Filesys::POSIX, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Filesys::POSIX
CPAN shell
perl -MCPAN -e shell install Filesys::POSIX
For more information on module installation, please visit the detailed CPAN module installation guide.