package <Name>;

require Exporter;
require DynaLoader;
require AutoLoader;

@ISA = qw(Exporter DynaLoader);
# Items to export into callers namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.
@EXPORT = qw(
	<Constants>
);
# Other items we are prepared to export if requested
@EXPORT_OK = qw(
);

%EXPORT_TAGS = (
	<Tags>
);

sub import {
	my($y,@sym) = @_;
	my($x);

#	my(%symx);   # Buggy! AARRGGHH!
	local(%symx);
	
	map($symx{$_}=1,@EXPORT,@EXPORT_OK);
	for $x (@sym) {
			next if $symx{$x} or $symx{"\&$x"} or (/^[-+:]/ =~ $x);
			($pack,$file,$line) = caller;
			die 
			
"Invalid constant $x in $file, line $line.  If this constant is
present in your system, and you need it, please edit
`<Directory>/<Name>.def'
and add it at the end. Then, go to the <Directory>
directory, and regenerate the <Name> extension by typing `make install'.
(You probably will need root privs to do this.) You may wish to contact the
perl5 developers (or leave a message on comp.lang.perl) if you think this
constant should be supplied in the distribution.

";
	}
	goto &Exporter::import;
}

sub AUTOLOAD {
    # This AUTOLOAD is used to 'autoload' constants from the constant()
    # XS function.  If a constant is not found then control is passed
    # to the AUTOLOAD in AutoLoader.

    # NOTE: THIS AUTOLOAD FUNCTION IS FLAWED (but is the best we can do for now).
    # Avoid old-style ``&CONST'' usage. Either remove the ``&'' or add ``()''.
    if (@_ > 0) {
	$AutoLoader::AUTOLOAD = $AUTOLOAD;
	goto &AutoLoader::AUTOLOAD;
    }
    local($constname);
    ($constname = $AUTOLOAD) =~ s/.*:://;
    $val = constant($constname, @_ ? $_[0] : 0);
    if ($! != 0) {
		if(errtype()==2) {
			($pack,$file,$line) = caller;
			die 
			
"Unknown <Name> constant $constname in $file, line $line.  If this constant is
present in your system, and you need it, please edit
`<Directory>/<Name>.def'
and add it at the end. Then, go to the <Directory> 
directory, and regenerate the <Name> extension by typing `make install'.
(You probably will need root privs to do this.) You may wish to contact the
perl5 developers (or leave a message on comp.lang.perl) if you think this
constant should be supplied in the distribution version of <Name>.

";
		} elsif (errtype()==3) {
			($pack,$file,$line) = caller;
			die 
			
"<Name> constant $constname, used in $file, line $line, has been explicitly
disabled, presumably because it doesn't work properly. Please read the file
`<Directory>/<Name>.def'
which may contain more information, or contact your perl maintainer.

";
		} elsif (errtype()==1) {
			($pack,$file,$line) = caller;
			 die 
			 
"Your vendor has not supplied <Name> constant $constname, used at $file,
line $line. If you know this constant is supplied, but is in a non-standard
header, you may wish to edit `<Directory>/<Name>.def'
and add a reference to the header near the beginning, and then regenerate
the <Name> extension by typing `make install'. (You will probably need root
privs to do this, so you may need to contact your local perl maintainer.)

";
		} else {
	    $AutoLoader::AUTOLOAD = $AUTOLOAD;
	    goto &AutoLoader::AUTOLOAD;
		}
    }
    eval "sub $AUTOLOAD { $val }";
    goto &$AUTOLOAD;
}

bootstrap <Name>;

# Preloaded methods go here.

# Autoload methods go after __END__, and are processed by the autosplit program.

1;
__END__

