IO::Seekable
Native Rust implementation built into the interpreter. Runtime: PP. See original documentation for the full Perl reference.
Provides seek/tell operations on filehandles compatible with Perl’s IO::Seekable.
IO::Seekable is a mixin class inherited by IO::File and others.
All methods delegate to FILEHANDLE_TABLE via the shared extract_fh_id() helper.
Functions
getpos
Returns the current byte position, equivalent to tell().
Intended for use with setpos() to save and restore positions.
my $pos = $fh->getpos();
### seek
Sets the filehandle position. `$whence` is one of SEEK_SET (0),
SEEK_CUR (1), or SEEK_END (2). Returns 1 on success, 0 on failure.
```perl
use IO::Seekable;
$fh->seek(0, SEEK_SET);
setpos
Sets the filehandle position to an absolute byte offset (equivalent to
seek($pos, SEEK_SET)). Returns 1 on success, 0 on failure.
$fh->setpos($saved_pos);
tell
Returns the current byte position in the filehandle, or -1 on error.
my $pos = $fh->tell();