NAME
Filesys::POSIX::Userland::Test - Inode conditional tests
SYNOPSIS
use Filesys::POSIX;
use Filesys::POSIX::Mem;
use Filesys::POSIX::Userland::Test;
my $fs = Filesys::POSIX->new(Filesys::POSIX::Real->new,
'noatime' => 1
);
$fs->touch('foo');
$fs->is_file('foo'); # returns 1
$fs->is_dir('foo'); # returns 0
DESCRIPTION
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
.
This module exposes the inode-level tests in the Filesys::POSIX::Inode base class at a higher, file-oriented level.
TESTS
$FS->exists($path)
-
Returns true if an inode indicated by
$path
exists. $fs->is_file($path)
-
Returns true if an inode indicated by
$path
exists and is a regular file ($S_IFREG
). $fs->is_dir($path)
-
Returns true if an inode indicated by
$path
exists and is a directory ($S_IFDIR
). $fs->is_link($path)
-
Returns true if an inode indicated by
$path
exists and is a symlink ($S_IFLNK
). $fs->is_char($path)
-
Returns true if an inode indicated by
$path
exists and is a character device ($S_IFCHR
). $fs->is_block($path)
-
Returns true if an inode indicated by
$path
exists and is a block device ($S_IFBLK
). $fs->is_fifo($path)
-
Returns true if an inode indicated by
$path
exists and is a FIFO ($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
). $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
). $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
). $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
). $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
).
SEE ALSO
AUTHOR
Written by Xan Tronix <xan@cpan.org>
CONTRIBUTORS
COPYRIGHT
Copyright (c) 2014, cPanel, Inc. Distributed under the terms of the Perl Artistic license.