package Hesiod;

use strict;
use Carp;
use vars qw($VERSION @ISA @EXPORT $AUTOLOAD);

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(
	hes_to_bind
);
@EXPORT_OK = qw(
	DEF_LHS
	DEF_RHS
	HESIOD_CONF
	HES_ER_CONFIG
	HES_ER_NET
	HES_ER_NOTFOUND
	HES_ER_OK
	HES_ER_UNINIT
);
$VERSION = '0.01';

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.

    my $constname;
    ($constname = $AUTOLOAD) =~ s/.*:://;
    my $val = constant($constname, @_ ? $_[0] : 0);
    if ($! != 0) {
	if ($! =~ /Invalid/) {
	    $AutoLoader::AUTOLOAD = $AUTOLOAD;
	    goto &AutoLoader::AUTOLOAD;
	}
	else {
		croak "Your vendor has not defined Hesiod macro $constname";
	}
    }
    if ($val+0 eq $val) {
	eval "sub $AUTOLOAD { $val }";
    } else {
	eval "sub $AUTOLOAD { '$val' }";
    }
    goto &$AUTOLOAD;
}

bootstrap Hesiod $VERSION;

# Preloaded methods go here.

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

1;
__END__
# Below is the stub of documentation for your module. You better edit it!

=head1 NAME

Hesiod - Perl interface to the Hesiod library

=head1 SYNOPSIS

  use Hesiod;
  hes_resolve

=head1 DESCRIPTION

=head1 AUTHOR

Albert Dvornik, bert@mit.edu

=head1 SEE ALSO

hesiod(3), perl(1).

=cut
