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