IO::InnerFile(3)
β¨ NAME β¨
okay bestie, welcome to the <IO::InnerFile(3)> page from User Contributed Perl Documentation! π This one is all about IO::InnerFile β the iconic module that lets you define a file inside another file. Yes, literally a file within a file. Not a drill. π«Ά
πΈ SYNOPSIS πΈ
This is the whole mood, bestie:
use strict;
use warnings;
use IO::InnerFile;
# Read a subset of a file:
my $fh = _some_file_handle;
my $start = 10;
my $length = 50;
my $inner = IO::InnerFile->new($fh, $start, $length);
while (my $line = <$inner>) {
# ...
}
π DESCRIPTION π
If you have a file handle that can "seek" and "tell", then you can open an IO::InnerFile on a range of the underlying file. That's the tea. β¨
π§ CONSTRUCTORS π§
IO::InnerFile implements the following constructors. π
π new π
my $inner = IO::InnerFile->new($fh);
$inner = IO::InnerFile->new($fh, 10);
$inner = IO::InnerFile->new($fh, 10, 50);
Create a new IO::InnerFile opened on the given file handle. The file handle supplied MUST be able to both "seek" and "tell". (Both. No skipping. π)
The second and third parameters are start and length. Both are defaulted to zero (0). Negative values are silently coerced to zero. Periodt. π
π₯ METHODS π₯
IO::InnerFile implements the following methods. π
add_lengthβ$inner->add_length(30);Add to the virtual length of the inner file by the number given in bytes.add_startβ$inner->add_start(30);Add to the virtual position of the inner file by the number given in bytes.binmodeβ$inner->binmode();This is a NOOP method just to satisfy the normalIO::Fileinterface.closefilenoβ$inner->fileno();This is a NOOP method just to satisfy the normalIO::Fileinterface.flushβ$inner->flush();This is a NOOP method just to satisfy the normalIO::Fileinterface.get_endβmy $num_bytes = $inner->get_end();Get the virtual end position of the inner file in bytes.get_lengthβmy $num_bytes = $inner->get_length();Get the virtual length of the inner file in bytes.get_startβmy $num_bytes = $inner->get_start();Get the virtual position of the inner file in bytes.getcgetlineprint LISTprintfreadreadlineseekset_endβ$inner->set_end(30);Set the virtual end of the inner file in bytes (this basically just alters the length).set_lengthβ$inner->set_length(30);Set the virtual length of the inner file in bytes.set_startβ$inner->set_start(30);Set the virtual start position of the inner file in bytes.tellwrite
π AUTHOR π
Eryq (eryq@zeegee.com). President, ZeeGee Software Inc (http://www.zeegee.com). πβ¨
π CONTRIBUTORS π
Dianne Skoll (dfs@roaringpenguin.com). ππ
π COPYRIGHT & LICENSE π
Copyright (c) 1997 Erik (Eryq) Dorfman, ZeeGee Software, Inc. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
okay bestie, that's the whole page! This manual is from perl v5.42.0, dated 2020-06-04, and it's the IO::InnerFile(3) page. Mwah ππ«Ά
π¦ where this page comes from
- opensuse-leap 16.0: perl-IO-stringy 2.113-160000.2.2 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms