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); if ($! != 0) { if ($! =~ /((Invalid)|(not valid))/i || $!{EINVAL}) { $AutoLoader::AUTOLOAD = $AUTOLOAD; goto &AutoLoader::AUTOLOAD; } else { croak "Your vendor has not defined SSLeay macro $constname"; } } eval "sub $AUTOLOAD { $val }"; goto &$AUTOLOAD; } #### static double constant(char* name) { errno = 0; switch (*name) { case 'A': if (strEQ(name, "AT_MD5_WITH_RSA_ENCRYPTION")) #ifdef SSL_AT_MD5_WITH_RSA_ENCRYPTION return SSL_AT_MD5_WITH_RSA_ENCRYPTION; #else goto not_there; #endif break; /* Snip similar for B..Z */ case '_': if (strEQ(name, "_TEST_INVALID_CONSTANT")) goto not_there; } errno = EINVAL; return 0; not_there: errno = ENOENT; return 0; }