| File::RandomAccess(3pm) | User Contributed Perl Documentation | File::RandomAccess(3pm) |
File::RandomAccess - Random access reads of sequential file or scalar
use File::RandomAccess;
$raf = File::RandomAccess->new(\*FILE, $disableSeekTest);
$raf = File::RandomAccess->new(\$data);
$err = $raf->Seek($pos);
$num = $raf->Read($buff, $bytes);
Allows random access to sequential file by buffering the file if necessary. Also allows access to data in memory to be accessed as if it were a file.
# Read from open file or pipe
$raf = File::RandomAccess->new(\*FILE);
# Read from data in memory
$raf = File::RandomAccess->new(\$data);
$result = $raf->SeekTest();
$pos = $raf->Tell();
$success = $raf->Seek($pos, 0);
$num = $raf->Read($buff, 1024);
$raf->{NoBuffer} = 1;
When this option is set, old data is purged from the internal buffer before a read operation on a sequential file. In this mode, memory requirements may be significantly reduced when reading sequential files, but seeking backward is limited to within the size of the internal buffer (which will be at least as large as the last returned data block), and seeking relative to the end of file is not allowed.
Copyright 2003-2024, Phil Harvey (philharvey66 at gmail.com)
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Image::ExifTool(3pm)
| 2024-02-03 | perl v5.38.2 |