access#

Check the caller’s permissions on a path.

Σύνοψη#

use POSIX qw(access R_OK W_OK);
print "readable\n" if access($path, R_OK);

Τι επιστρέφεται#

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.

Οριακές περιπτώσεις#

  • Check uses real (not effective) UID/GID, so is vulnerable to TOCTOU races; prefer trying the operation and handling failure.

Διαφορές από το upstream#

Fully compatible with upstream POSIX.