1package <Name>; 2 3require Exporter; 4require DynaLoader; 5require AutoLoader; 6 7$VERSION = '<Version>'; 8 9@ISA = qw(Exporter DynaLoader); 10 11@EXPORT_OK = qw( 12 <Constants> 13); 14 15%EXPORT_TAGS = ( 16 <Tags> 17); 18 19sub AUTOLOAD { 20 # This AUTOLOAD is used to 'autoload' constants from the constant() 21 # XS function. If a constant is not found then control is passed 22 # to the AUTOLOAD in AutoLoader. 23 24 # NOTE: THIS AUTOLOAD FUNCTION IS FLAWED (but is the best we can do for now). 25 # Avoid old-style ``&CONST'' usage. Either remove the ``&'' or add ``()''. 26 if (@_ > 0) { 27 $AutoLoader::AUTOLOAD = $AUTOLOAD; 28 goto &AutoLoader::AUTOLOAD; 29 } 30 local($constname); 31 ($constname = $AUTOLOAD) =~ s/.*:://; 32 $val = constant($constname, @_ ? $_[0] : 0); 33 if ($! != 0) { 34 if(errtype()==2) { # spelling? 35 ($pack,$file,$line) = caller; 36 die 37"Unknown <Name> constant $constname in $file, line $line. If you 38need this constant, please edit `<Directory>/<Name>.def' and add 39it at the end. Then, go to the <Directory> directory, and regenerate 40the <Name> extension by typing `make install'. (You might need root privs.) 41 42If you think this constant should be supplied by default then contact 43the perl5 developers (or leave a message on comp.lang.perl). 44"; 45 } elsif (errtype()==3) { # disabled 46 ($pack,$file,$line) = caller; 47 die 48 49"<Name> constant $constname, used in $file, line $line, is explicitly 50disabled. Please read the file `<Directory>/<Name>.def' which may contain 51more information. 52"; 53 } elsif (errtype()==1) { # missing includes 54 ($pack,$file,$line) = caller; 55 die 56"<Name> constant $constname used at $file, line $line is not available. 57If you know which header file to include, you can edit 58`<Directory>/<Name>.def' and then regenerate the <Name> extension by 59typing `make install'. (You might need root privs.) 60"; 61 } else { 62 $AutoLoader::AUTOLOAD = $AUTOLOAD; 63 goto &AutoLoader::AUTOLOAD; 64 } 65 } 66 eval "sub $AUTOLOAD { $val }"; 67 goto &$AUTOLOAD; 68} 69 70<Name>->bootstrap($VERSION); 71 72# Preloaded methods go here. 73 74# Autoload methods go after __END__, and are processed by the autosplit program. 75 761; 77__END__ 78 79