Fcntl

use Fcntl;              # Import standard fcntl.h constants.
use Fcntl ":flock";     # Import LOCK_* constants.
use Fcntl ":seek";      # Import SEEK_CUR, SEEK_SET, SEEK_END.
use Fcntl ":mode";      # Import S_* stat checking constants.
use Fcntl ":Fcompat";   # Import F* constants.

The Fcntl module provides constants for use with various Perl built-in functions. The default set of imports includes constants like F_GETFL and F_SETFL for fcntl, SEEK_SET and SEEK_END for seek and sysseek, and O_CREAT and O_EXCL for sysopen. Supported import tags include ":flock" to access the LOCK_EX, LOCK_NB, LOCK_SH, and LOCK_UN constants for flock; ":mode" to get at constants from sys/stat.h like S_IRUSR and S_ISFIFO; ":seek" to get at the three arguments for seek and sysseek; and ":Fcompat" to get the old-style symbols with a leading "F" but not "F_", like FAPPEND, FASYNC, and FNONBLOCK. See the online documentation for the Fcntl module and your operating system's documentation on the relevant syscalls, like fcntl (2), lseek (2), open (2), and stat (2).

Get Programming Perl, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.