Debian Codegraph @

upstream/debian-unstable/man3/IO::Seekable.3perl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\" ========================================================================
56 .\"
57 .IX Title "IO::Seekable 3perl"
58 .TH IO::Seekable 3perl 2025-11-16 "perl v5.40.1" "Perl Programmers Reference Guide"
59 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
60 .\" way too many mistakes in technical documents.
61 .if n .ad l
62 .nh
63 .SH NAME
64 IO::Seekable \- supply seek based methods for I/O objects
65 .SH SYNOPSIS
66 .IX Header "SYNOPSIS"
67 .Vb 3
68 \& use IO::Seekable;
69 \& package IO::Something;
70 \& @ISA = qw(IO::Seekable);
71 .Ve
72 .SH DESCRIPTION
73 .IX Header "DESCRIPTION"
74 \&\f(CW\*(C`IO::Seekable\*(C'\fR does not have a constructor of its own as it is intended to
75 be inherited by other \f(CW\*(C`IO::Handle\*(C'\fR based objects. It provides methods
76 which allow seeking of the file descriptors.
77 .ie n .IP $io\->getpos 4
78 .el .IP \f(CW$io\fR\->getpos 4
79 .IX Item "$io->getpos"
80 Returns an opaque value that represents the current position of the
81 IO::File, or \f(CW\*(C`undef\*(C'\fR if this is not possible (eg an unseekable stream such
82 as a terminal, pipe or socket). If the \fBfgetpos()\fR function is available in
83 your C library it is used to implements getpos, else perl emulates getpos
84 using C's \fBftell()\fR function.
85 .ie n .IP $io\->setpos 4
86 .el .IP \f(CW$io\fR\->setpos 4
87 .IX Item "$io->setpos"
88 Uses the value of a previous getpos call to return to a previously visited
89 position. Returns "0 but true" on success, \f(CW\*(C`undef\*(C'\fR on failure.
90 .PP
91 See perlfunc for complete descriptions of each of the following
92 supported \f(CW\*(C`IO::Seekable\*(C'\fR methods, which are just front ends for the
93 corresponding built-in functions:
94 .ie n .IP "$io\->seek ( POS, WHENCE )" 4
95 .el .IP "\f(CW$io\fR\->seek ( POS, WHENCE )" 4
96 .IX Item "$io->seek ( POS, WHENCE )"
97 Seek the IO::File to position POS, relative to WHENCE:
98 .RS 4
99 .IP "WHENCE=0 (SEEK_SET)" 8
100 .IX Item "WHENCE=0 (SEEK_SET)"
101 POS is absolute position. (Seek relative to the start of the file)
102 .IP "WHENCE=1 (SEEK_CUR)" 8
103 .IX Item "WHENCE=1 (SEEK_CUR)"
104 POS is an offset from the current position. (Seek relative to current)
105 .IP "WHENCE=2 (SEEK_END)" 8
106 .IX Item "WHENCE=2 (SEEK_END)"
107 POS is an offset from the end of the file. (Seek relative to end)
108 .RE
109 .RS 4
110 .Sp
111 The SEEK_* constants can be imported from the \f(CW\*(C`Fcntl\*(C'\fR module if you
112 don't wish to use the numbers \f(CW0\fR \f(CW1\fR or \f(CW2\fR in your code.
113 .Sp
114 Returns \f(CW1\fR upon success, \f(CW0\fR otherwise.
115 .RE
116 .ie n .IP "$io\->sysseek( POS, WHENCE )" 4
117 .el .IP "\f(CW$io\fR\->sysseek( POS, WHENCE )" 4
118 .IX Item "$io->sysseek( POS, WHENCE )"
119 Similar to \f(CW$io\fR\->seek, but sets the IO::File's position using the system
120 call \fBlseek\fR\|(2) directly, so will confuse most perl IO operators except
121 sysread and syswrite (see perlfunc for full details)
122 .Sp
123 Returns the new position, or \f(CW\*(C`undef\*(C'\fR on failure. A position
124 of zero is returned as the string \f(CW"0 but true"\fR
125 .ie n .IP $io\->tell 4
126 .el .IP \f(CW$io\fR\->tell 4
127 .IX Item "$io->tell"
128 Returns the IO::File's current position, or \-1 on error.
129 .SH "SEE ALSO"
130 .IX Header "SEE ALSO"
131 perlfunc,
132 "I/O Operators" in perlop,
133 IO::Handle
134 IO::File
135 .SH HISTORY
136 .IX Header "HISTORY"
137 Derived from FileHandle.pm by Graham Barr <[email protected]>