Debian Codegraph @

upstream/opensuse-tumbleweed/man3/IO::Seekable.3pm

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man v6.0.2 (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 .\" Required to disable full justification in groff 1.23.0.
57 .if n .ds AD l
58 .\" ========================================================================
59 .\"
60 .IX Title "IO::Seekable 3pm"
61 .TH IO::Seekable 3pm 2026-03-09 "perl v5.42.1" "Perl Programmers Reference Guide"
62 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
63 .\" way too many mistakes in technical documents.
64 .if n .ad l
65 .nh
66 .SH NAME
67 IO::Seekable \- supply seek based methods for I/O objects
68 .SH SYNOPSIS
69 .IX Header "SYNOPSIS"
70 .Vb 3
71 \& use IO::Seekable;
72 \& package IO::Something;
73 \& @ISA = qw(IO::Seekable);
74 .Ve
75 .SH DESCRIPTION
76 .IX Header "DESCRIPTION"
77 \&\f(CW\*(C`IO::Seekable\*(C'\fR does not have a constructor of its own as it is intended to
78 be inherited by other \f(CW\*(C`IO::Handle\*(C'\fR based objects. It provides methods
79 which allow seeking of the file descriptors.
80 .ie n .IP $io\->getpos 4
81 .el .IP \f(CW$io\fR\->getpos 4
82 .IX Item "$io->getpos"
83 Returns an opaque value that represents the current position of the
84 IO::File, or \f(CW\*(C`undef\*(C'\fR if this is not possible (eg an unseekable stream such
85 as a terminal, pipe or socket). If the \fBfgetpos()\fR function is available in
86 your C library it is used to implements getpos, else perl emulates getpos
87 using C\*(Aqs \fBftell()\fR function.
88 .ie n .IP $io\->setpos 4
89 .el .IP \f(CW$io\fR\->setpos 4
90 .IX Item "$io->setpos"
91 Uses the value of a previous getpos call to return to a previously visited
92 position. Returns "0 but true" on success, \f(CW\*(C`undef\*(C'\fR on failure.
93 .PP
94 See perlfunc for complete descriptions of each of the following
95 supported \f(CW\*(C`IO::Seekable\*(C'\fR methods, which are just front ends for the
96 corresponding built\-in functions:
97 .ie n .IP "$io\->seek ( POS, WHENCE )" 4
98 .el .IP "\f(CW$io\fR\->seek ( POS, WHENCE )" 4
99 .IX Item "$io->seek ( POS, WHENCE )"
100 Seek the IO::File to position POS, relative to WHENCE:
101 .RS 4
102 .IP "WHENCE=0 (SEEK_SET)" 8
103 .IX Item "WHENCE=0 (SEEK_SET)"
104 POS is absolute position. (Seek relative to the start of the file)
105 .IP "WHENCE=1 (SEEK_CUR)" 8
106 .IX Item "WHENCE=1 (SEEK_CUR)"
107 POS is an offset from the current position. (Seek relative to current)
108 .IP "WHENCE=2 (SEEK_END)" 8
109 .IX Item "WHENCE=2 (SEEK_END)"
110 POS is an offset from the end of the file. (Seek relative to end)
111 .RE
112 .RS 4
113 .Sp
114 The SEEK_* constants can be imported from the \f(CW\*(C`Fcntl\*(C'\fR module if you
115 don\*(Aqt wish to use the numbers \f(CW0\fR \f(CW1\fR or \f(CW2\fR in your code.
116 .Sp
117 Returns \f(CW1\fR upon success, \f(CW0\fR otherwise.
118 .RE
119 .ie n .IP "$io\->sysseek( POS, WHENCE )" 4
120 .el .IP "\f(CW$io\fR\->sysseek( POS, WHENCE )" 4
121 .IX Item "$io->sysseek( POS, WHENCE )"
122 Similar to \f(CW$io\fR\->seek, but sets the IO::File\*(Aqs position using the system
123 call \fBlseek\fR\|(2) directly, so will confuse most perl IO operators except
124 sysread and syswrite (see perlfunc for full details)
125 .Sp
126 Returns the new position, or \f(CW\*(C`undef\*(C'\fR on failure. A position
127 of zero is returned as the string \f(CW"0 but true"\fR
128 .ie n .IP $io\->tell 4
129 .el .IP \f(CW$io\fR\->tell 4
130 .IX Item "$io->tell"
131 Returns the IO::File\*(Aqs current position, or \-1 on error.
132 .SH "SEE ALSO"
133 .IX Header "SEE ALSO"
134 perlfunc,
135 "I/O Operators" in perlop,
136 IO::Handle
137 IO::File
138 .SH HISTORY
139 .IX Header "HISTORY"
140 Derived from FileHandle.pm by Graham Barr <[email protected]>