Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.4 KiB

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