home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / perl-5.003-base.tgz / perl-5.003-base.tar / fsf / perl / ext / Fcntl / Fcntl.pm next >
Text File  |  1996-02-12  |  2KB  |  74 lines

  1. package Fcntl;
  2.  
  3. =head1 NAME
  4.  
  5. Fcntl - load the C Fcntl.h defines
  6.  
  7. =head1 SYNOPSIS
  8.  
  9.     use Fcntl;
  10.  
  11. =head1 DESCRIPTION
  12.  
  13. This module is just a translation of the C F<fnctl.h> file.
  14. Unlike the old mechanism of requiring a translated F<fnctl.ph>
  15. file, this uses the B<h2xs> program (see the Perl source distribution)
  16. and your native C compiler.  This means that it has a 
  17. far more likely chance of getting the numbers right.
  18.  
  19. =head1 NOTE
  20.  
  21. Only C<#define> symbols get translated; you must still correctly
  22. pack up your own arguments to pass as args for locking functions, etc.
  23.  
  24. =cut
  25.  
  26. use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD);
  27.  
  28. require Exporter;
  29. use AutoLoader;
  30. require DynaLoader;
  31. @ISA = qw(Exporter DynaLoader);
  32. $VERSION = "1.00";
  33. # Items to export into callers namespace by default
  34. # (move infrequently used names to @EXPORT_OK below)
  35. @EXPORT =
  36.   qw(
  37.      F_DUPFD F_GETFD F_GETLK F_SETFD F_GETFL F_SETFL F_SETLK F_SETLKW
  38.      FD_CLOEXEC F_RDLCK F_UNLCK F_WRLCK
  39.      O_CREAT O_EXCL O_NOCTTY O_TRUNC
  40.      O_APPEND O_NONBLOCK
  41.      O_NDELAY
  42.      O_RDONLY O_RDWR O_WRONLY
  43.      );
  44. # Other items we are prepared to export if requested
  45. @EXPORT_OK = qw(
  46. );
  47.  
  48. sub AUTOLOAD {
  49.     my($constname);
  50.     ($constname = $AUTOLOAD) =~ s/.*:://;
  51.     my $val = constant($constname, @_ ? $_[0] : 0);
  52.     if ($! != 0) {
  53.     if ($! =~ /Invalid/) {
  54.         $AutoLoader::AUTOLOAD = $AUTOLOAD;
  55.         goto &AutoLoader::AUTOLOAD;
  56.     }
  57.     else {
  58.         my ($pack,$file,$line) = caller;
  59.         die "Your vendor has not defined Fcntl macro $constname, used at $file line $line.
  60. ";
  61.     }
  62.     }
  63.     eval "sub $AUTOLOAD { $val }";
  64.     goto &$AUTOLOAD;
  65. }
  66.  
  67. bootstrap Fcntl $VERSION;
  68.  
  69. # Preloaded methods go here.  Autoload methods go after __END__, and are
  70. # processed by the autosplit program.
  71. package Fcntl; # return to package Fcntl so AutoSplit is happy
  72. 1;
  73. __END__
  74.