access#
Check the caller’s permissions on a path.
Synopsis#
use POSIX qw(access R_OK W_OK);
print "readable\n" if access($path, R_OK);
What you get back#
The string "0 but true" when the access check succeeds, or
undef when it fails (with $! set). The "0 but true" return
matches core Perl’s convention for system calls whose success
value is 0.
Edge cases#
Check uses real (not effective) UID/GID, so is vulnerable to TOCTOU races; prefer trying the operation and handling failure.
Differences from upstream#
Fully compatible with upstream POSIX.