perl 5.003_03: [patch introduction and re-organisation]
[p5sagit/p5-mst-13.2.git] / ext / Fcntl / Fcntl.pm
index c4fd2ff..32a3194 100644 (file)
@@ -1,9 +1,35 @@
 package Fcntl;
 
+=head1 NAME
+
+Fcntl - load the C Fcntl.h defines
+
+=head1 SYNOPSIS
+
+    use Fcntl;
+
+=head1 DESCRIPTION
+
+This module is just a translation of the C F<fnctl.h> file.
+Unlike the old mechanism of requiring a translated F<fnctl.ph>
+file, this uses the B<h2xs> program (see the Perl source distribution)
+and your native C compiler.  This means that it has a 
+far more likely chance of getting the numbers right.
+
+=head1 NOTE
+
+Only C<#define> symbols get translated; you must still correctly
+pack up your own arguments to pass as args for locking functions, etc.
+
+=cut
+
+use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD);
+
 require Exporter;
-require AutoLoader;
+use AutoLoader;
 require DynaLoader;
-@ISA = (Exporter, AutoLoader, DynaLoader);
+@ISA = qw(Exporter DynaLoader);
+$VERSION = "1.00";
 # Items to export into callers namespace by default
 # (move infrequently used names to @EXPORT_OK below)
 @EXPORT =
@@ -20,20 +46,16 @@ require DynaLoader;
 );
 
 sub AUTOLOAD {
-    if (@_ > 1) {
-       $AutoLoader::AUTOLOAD = $AUTOLOAD;
-       goto &AutoLoader::AUTOLOAD;
-    }
-    local($constname);
+    my($constname);
     ($constname = $AUTOLOAD) =~ s/.*:://;
-    $val = constant($constname, @_ ? $_[0] : 0);
+    my $val = constant($constname, @_ ? $_[0] : 0);
     if ($! != 0) {
        if ($! =~ /Invalid/) {
            $AutoLoader::AUTOLOAD = $AUTOLOAD;
            goto &AutoLoader::AUTOLOAD;
        }
        else {
-           ($pack,$file,$line) = caller;
+           my ($pack,$file,$line) = caller;
            die "Your vendor has not defined Fcntl macro $constname, used at $file line $line.
 ";
        }
@@ -42,7 +64,7 @@ sub AUTOLOAD {
     goto &$AUTOLOAD;
 }
 
-bootstrap Fcntl;
+bootstrap Fcntl $VERSION;
 
 # Preloaded methods go here.  Autoload methods go after __END__, and are
 # processed by the autosplit program.