# This AUTOLOAD is used to 'autoload' constants from the constant() XS function. sub AUTOLOAD { my $constname; our $AUTOLOAD; ($constname = $AUTOLOAD) =~ s/.*:://; croak "&Blah::constant not defined" if $constname eq 'constant'; my ($error, $val) = constant($constname); if ($error) { croak $error; } { no strict 'refs'; *$AUTOLOAD = sub { $val }; } goto &$AUTOLOAD; } #### foreach my $constname (@constants) { { no strict 'refs'; *$constname = sub { use strict; my ($error, $val) = constant($constname); if ($error) { croak $error; } return $val; } } }