© 2013 TutorialsPoint.COM
PERL sysopen Function
sysopen FILEHANDLE, FILENAME, MODE, PERMS
sysopen FILEHANDLE, FILENAME, MODE
Definition and Usage
Equivalent to the underlying C and operating system call open( ). Opens the file specified by FILENAME, associating it with FILEHANDLE. The MODE argument specifies how the file should be opened. The values of MODE are system dependent, but some values are historically set. Values of 0, 1, and 2 mean read-only, write-only, and read/write, respectively. The supported values are available in the Fcntl module, and are summarized in below Table. Note that FILENAME is strictly a file name; no interpretation of the contents takes place (unlike open), and the mode of opening is defined by the MODE argument.
If the file has to be created, and the O_CREAT flag has been specified in MODE, then the file is created with the permissions of PERMS. The value of PERMS must be specified in traditional Unix-style hexadecimal. If PERMS is not specified, then Perl uses a default mode of 0666 (read/write on user/group/other).
O_RDONLY Read only.
O_WRONLY Write only.
O_RDWR Read and write.
O_CREAT Create the file if it doesn.t already exist.
O_EXCL Fail if the file already exists.
O_APPEND Append to an existing file.
O_TRUNC Truncate the file before opening.
O_NONBLOCK Non-blocking mode.
O_NDELAY Equivalent of O_NONBLOCK.
O_EXLOCK Lock using flock and LOCK_EX.
O_SHLOCK Lock using flock and LOCK_SH.
O_DIRECTOPRY Fail if the file is not a directory.
O_NOFOLLOW Fail if the last path component is a symbolic link.
O_BINARY Open in binary mode (implies a call to binmode).
O_LARGEFILE Open with large (>2GB) file support.
O_SYNC Write data physically to the disk, instead of
O_NOCTTY Don't make the terminal file being opened
the processescontrolling terminal, even if you
don.t have one yet.
0 on failure
1 on success