FileHandle
Native Rust implementation built into the interpreter. Runtime: PP. See original documentation for the full Perl reference.
FileHandle is a compatibility module that wraps IO::File and IO::Handle.
In perl5, itβs a thin shim that re-exports IO::File functionality.
We provide a native Rust implementation because the perl5 FileHandle.pm
does use IO::File which does use IO which tries XSLoader::load 'IO',
and that fails under pperl since we have no XS support.
This module sets up the FileHandle package with proper @ISA inheritance from IO::File and IO::Seekable, registers method stubs, and provides dispatch for the key methods that FileHandle exposes.
Perl Equivalent
package FileHandle;
require 5.000;
use strict;
use IO::File;
our @ISA = qw(IO::File);
our $VERSION = "2.05";
Methods
Most methods are inherited from IO::File / IO::Handle. The ones registered
here are stubs to ensure method resolution works and can() succeeds.
new()- Constructor, returns a blessed FileHandle referencenew_from_fd($fd, $mode)- Constructor from file descriptoropen($file [, $mode])- Open a filefdopen($fd, $mode)- Open from file descriptorclose()- Close handleprint(@args)- Output dataprintf($fmt, @args)- Formatted outputsay(@args)- Output with newlinegetline()- Read one linegetlines()- Read all linesautoflush([$val])- Get/set autoflushflush()- Flush outputeof()- Test end of filefileno()- Get file descriptorread($buf, $len [, $offset])- Read bytessysread($buf, $len [, $offset])- Low-level readsyswrite($buf [, $len [, $offset]])- Low-level writeseek($pos, $whence)- Seektell()- Tell positionbinmode([$layer])- Set binary modetruncate($len)- Truncate filestat()- File statopened()- Check if openblocking([$flag])- Get/set blocking mode
Exports
autoflush(default export)- SEEK_SET, SEEK_CUR, SEEK_END constants (via @EXPORT_OK)