home *** CD-ROM | disk | FTP | other *** search
/ isnet Internet / Isnet Internet CD.iso / prog / hiz / 09 / 09.exe / adynware.exe / perl / lib / IO / Seekable.pm < prev    next >
Encoding:
Perl POD Document  |  1999-12-28  |  1.4 KB  |  68 lines

  1.  
  2. package IO::Seekable;
  3.  
  4. =head1 NAME
  5.  
  6. IO::Seekable - supply seek based methods for I/O objects
  7.  
  8. =head1 SYNOPSIS
  9.  
  10.     use IO::Seekable;
  11.     package IO::Something;
  12.     @ISA = qw(IO::Seekable);
  13.  
  14. =head1 DESCRIPTION
  15.  
  16. C<IO::Seekable> does not have a constuctor of its own as is intended to
  17. be inherited by other C<IO::Handle> based objects. It provides methods
  18. which allow seeking of the file descriptors.
  19.  
  20. If the C functions fgetpos() and fsetpos() are available, then
  21. C<IO::File::getpos> returns an opaque value that represents the
  22. current position of the IO::File, and C<IO::File::setpos> uses
  23. that value to return to a previously visited position.
  24.  
  25. See L<perlfunc> for complete descriptions of each of the following
  26. supported C<IO::Seekable> methods, which are just front ends for the
  27. corresponding built-in functions:
  28.  
  29.     seek
  30.     tell
  31.  
  32. =head1 SEE ALSO
  33.  
  34. L<perlfunc>, 
  35. L<perlop/"I/O Operators">,
  36. L<IO::Handle>
  37. L<IO::File>
  38.  
  39. =head1 HISTORY
  40.  
  41. Derived from FileHandle.pm by Graham Barr E<lt>bodg@tiuk.ti.comE<gt>
  42.  
  43. =cut
  44.  
  45. require 5.000;
  46. use Carp;
  47. use strict;
  48. use vars qw($VERSION @EXPORT @ISA);
  49. use IO::Handle qw(SEEK_SET SEEK_CUR SEEK_END);
  50. require Exporter;
  51.  
  52. @EXPORT = qw(SEEK_SET SEEK_CUR SEEK_END);
  53. @ISA = qw(Exporter);
  54.  
  55. $VERSION = "1.06";
  56.  
  57. sub seek {
  58.     @_ == 3 or croak 'usage: $fh->seek(POS, WHENCE)';
  59.     seek($_[0], $_[1], $_[2]);
  60. }
  61.  
  62. sub tell {
  63.     @_ == 1 or croak 'usage: $fh->tell()';
  64.     tell($_[0]);
  65. }
  66.  
  67. 1;
  68.