d3f73c4cd7bddb9ba8767c0bb3a9c5f93904680e
[p5sagit/p5-mst-13.2.git] / ext / Fcntl / Fcntl.pm
1 package Fcntl;
2
3 require Exporter;
4 require AutoLoader;
5 require DynaLoader;
6 @ISA = qw(Exporter DynaLoader);
7 # Items to export into callers namespace by default
8 # (move infrequently used names to @EXPORT_OK below)
9 @EXPORT =
10   qw(
11      F_DUPFD F_GETFD F_GETLK F_SETFD F_GETFL F_SETFL F_SETLK F_SETLKW
12      FD_CLOEXEC F_RDLCK F_UNLCK F_WRLCK
13      O_CREAT O_EXCL O_NOCTTY O_TRUNC
14      O_APPEND O_NONBLOCK
15      O_NDELAY
16      O_RDONLY O_RDWR O_WRONLY
17      );
18 # Other items we are prepared to export if requested
19 @EXPORT_OK = qw(
20 );
21
22 sub AUTOLOAD {
23     local($constname);
24     ($constname = $AUTOLOAD) =~ s/.*:://;
25     $val = constant($constname, @_ ? $_[0] : 0);
26     if ($! != 0) {
27         if ($! =~ /Invalid/) {
28             $AutoLoader::AUTOLOAD = $AUTOLOAD;
29             goto &AutoLoader::AUTOLOAD;
30         }
31         else {
32             ($pack,$file,$line) = caller;
33             die "Your vendor has not defined Fcntl macro $constname, used at $file line $line.
34 ";
35         }
36     }
37     eval "sub $AUTOLOAD { $val }";
38     goto &$AUTOLOAD;
39 }
40
41 bootstrap Fcntl;
42
43 # Preloaded methods go here.  Autoload methods go after __END__, and are
44 # processed by the autosplit program.
45 package Fcntl; # return to package Fcntl so AutoSplit is happy
46 1;
47 __END__