open#

Open a file by path, returning a raw file descriptor.

תקציר#

use POSIX qw(open O_RDONLY O_CREAT O_WRONLY);
my $fd = open($path, O_RDONLY)
    or die "open: $!";

מה מוחזר#

A non-negative integer fd on success, undef on failure (with $! set). This is the raw system fd, not a Perl filehandle - pair it with POSIX::close or convert via IO::Handle::fdopen.

הבדלים מן ה-upstream#

Fully compatible with upstream POSIX. Third argument $mode defaults to 0666 when opening with O_CREAT and no mode given.

ראו גם#

  • close, dup, lseek, read, write - the rest of the raw fd API.

  • Core open - the Perl-native filehandle interface.