Book HomeJava and XSLTSearch this book

8.130. IO::Seekable

Intended to be inherited by other IO::Handle-based objects to provide methods that allow you to seek the file descriptors. Has no constructor.

use IO::Seekable;
package IO::XXX;
@ISA = qw(IO::Seekable);

Provides two methods.

seek

$fh->seek(offset, whence)

Frontend for the corresponding built-in seek function, which sets a filehandle's position in the file. Takes the following arguments:

offset
The offset where you want to set the position.

whence
The position in the file that the offset is relative to. Possible values are: 0 for the beginning of the file, 1 for the current position, or 2 for end of file. May also be expressed as the following constants, which are exported:

SEEK_SET
Beginning of file

SEEK_CUR
Current position

SEEK_END
End of file

tell

$fh->tell(  )

Frontend for the corresponding built-in tell function, which returns the current file position in bytes (starting from 0).



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.