1IO::InnerFile(3) User Contributed Perl Documentation IO::InnerFile(3)
2
3
4
6 IO::InnerFile - define a file inside another file
7
9 use strict;
10 use warnings;
11 use IO::InnerFile;
12
13 # Read a subset of a file:
14 my $fh = _some_file_handle;
15 my $start = 10;
16 my $length = 50;
17 my $inner = IO::InnerFile->new($fh, $start, $length);
18 while (my $line = <$inner>) {
19 # ...
20 }
21
23 If you have a file handle that can "seek" and "tell", then you can open
24 an IO::InnerFile on a range of the underlying file.
25
27 IO::InnerFile implements the following constructors.
28
29 new
30 my $inner = IO::InnerFile->new($fh);
31 $inner = IO::InnerFile->new($fh, 10);
32 $inner = IO::InnerFile->new($fh, 10, 50);
33
34 Create a new IO::InnerFile opened on the given file handle. The file
35 handle supplied MUST be able to both "seek" and "tell".
36
37 The second and third parameters are start and length. Both are
38 defaulted to zero (0). Negative values are silently coerced to zero.
39
41 IO::InnerFile implements the following methods.
42
43 add_length
44 $inner->add_length(30);
45
46 Add to the virtual length of the inner file by the number given in
47 bytes.
48
49 add_start
50 $inner->add_start(30);
51
52 Add to the virtual position of the inner file by the number given in
53 bytes.
54
55 binmode
56 $inner->binmode();
57
58 This is a NOOP method just to satisfy the normal IO::File interface.
59
60 close
61 fileno
62 $inner->fileno();
63
64 This is a NOOP method just to satisfy the normal IO::File interface.
65
66 flush
67 $inner->flush();
68
69 This is a NOOP method just to satisfy the normal IO::File interface.
70
71 get_end
72 my $num_bytes = $inner->get_end();
73
74 Get the virtual end position of the inner file in bytes.
75
76 get_length
77 my $num_bytes = $inner->get_length();
78
79 Get the virtual length of the inner file in bytes.
80
81 get_start
82 my $num_bytes = $inner->get_start();
83
84 Get the virtual position of the inner file in bytes.
85
86 getc
87 getline
88 print LIST
89 printf
90 read
91 readline
92 seek
93 set_end
94 $inner->set_end(30);
95
96 Set the virtual end of the inner file in bytes (this basically just
97 alters the length).
98
99 set_length
100 $inner->set_length(30);
101
102 Set the virtual length of the inner file in bytes.
103
104 set_start
105 $inner->set_start(30);
106
107 Set the virtual start position of the inner file in bytes.
108
109 tell
110 write
112 Eryq (eryq@zeegee.com). President, ZeeGee Software Inc
113 (http://www.zeegee.com).
114
116 Dianne Skoll (dfs@roaringpenguin.com).
117
119 Copyright (c) 1997 Erik (Eryq) Dorfman, ZeeGee Software, Inc. All
120 rights reserved.
121
122 This program is free software; you can redistribute it and/or modify it
123 under the same terms as Perl itself.
124
125
126
127perl v5.36.0 2023-01-20 IO::InnerFile(3)