FFI::C::PosixFile - Perl interface to C File pointer with POSIX extensions
version 0.15
use FFI::C::PosixFile; my $stdout = FFI::C::PosixFile->fdopen(1, "w"); say $stdout->fileno; # prints 1
This is a subclass of FFI::C::File which adds a couple of useful POSIX extensions that may not be available on non-POSIX systems. Trying to create an instance of this class will fail on platforms that do not support the extensions.
my $file = FFI::C::PosixFile->fopen($filename, $mode);
Opens the file with the given mode. See your standard library C documentation for the exact format of $mode
.
my $file = FFI::C::PosixFile->new($ptr);
Create a new File instance object from the opaque pointer. Note that it isn't possible to do any error checking on the type, so make sure that the pointer you are providing really is a C file pointer.
my $file = FFI::C::PosixFile->fdopen($fd, $mode);
Create a new File instance from a POSIX file descriptor.
my $fd = $file->fileno;
Returns the POSIX file descriptor for the file pointer.
Graham Ollis <plicease@cpan.org>
This software is copyright (c) 2020-2022 by Graham Ollis.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.