home *** CD-ROM | disk | FTP | other *** search
/ Acorn User 10 / AU_CD10.iso / Updates / Perl / Non-RPC / !Perl / lib / zip / IO / Seekable.pm < prev    next >
Text File  |  1999-01-06  |  1KB  |  69 lines

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