Name
fcntl
Synopsis
fcntl filehandle, function, arg
Calls the file control
function (with the function-specific
arg) to use on the file or device
opened with filehandle. fcntl calls Unix’s fcntl function (not available on Win32
platforms). If the function is not implemented, the program exits
with a fatal error. fcntl sets
file descriptors for a filehandle. This built-in command is usable
when you use the Fcntl module in the standard distribution:
use Fcntl;
This module imports the correct
functiondefinitions. See the
description of the Fcntl module in Chapter 8.
The return value of fcntl
(and ioctl) is as
follows:
System call returns | Perl returns |
|---|---|
| Undefined value |
| String |
Anything else | That number |
Thus Perl returns true on success and false on failure, yet you can still easily determine the actual value returned by the operating system.