commit 8c3c831dc40663bcc7593bd75cfc5eb33e5ea774
Author: Bart Van Assche <bvanassche@acm.org>
Date:   Thu Aug 11 10:31:40 2011 +0200

    CHANGES: Make the SNMP Perl module work on Windows. Background: passing errno from .xs to $! in .pm doesn t work if the Perl binaries and Net-SNMP have been compiled with different MSVC versions or in different modes (e.g. release versus debug).

diff --git a/perl/SNMP/SNMP.pm b/perl/SNMP/SNMP.pm
index 50658a1..64e6e8b 100644
--- a/perl/SNMP/SNMP.pm
+++ b/perl/SNMP/SNMP.pm
@@ -60,16 +60,10 @@ sub AUTOLOAD {
     ($constname = $AUTOLOAD) =~ s/.*:://;
     # croak "&$module::constant not defined" if $constname eq 'constant';
     $val = constant($constname, @_ ? $_[0] : 0);
-    if ($! != 0) {
-	if ($! =~ /Invalid/) {
-	    $AutoLoader::AUTOLOAD = $AUTOLOAD;
-	    goto &AutoLoader::AUTOLOAD;
-	}
-	else {
-	    ($pack,$file,$line) = caller;
-	    die "Your vendor has not defined SNMP macro $constname, used at $file line $line.
+    if ($val < -1) {
+	($pack,$file,$line) = caller;
+        die "Your vendor has not defined SNMP macro $constname, used at $file line $line.
 ";
-	}
     }
     eval "sub $AUTOLOAD { $val }";
     goto &$AUTOLOAD;
diff --git a/perl/SNMP/SNMP.xs b/perl/SNMP/SNMP.xs
index dfe5791..1676776 100644
--- a/perl/SNMP/SNMP.xs
+++ b/perl/SNMP/SNMP.xs
@@ -2409,7 +2409,6 @@ constant(name, arg)
 char *name;
 int arg;
 {
-    errno = 0;
     switch (*name) {
     case 'R':
 	if (strEQ(name, "NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE"))
@@ -2545,13 +2544,11 @@ int arg;
     default:
 	break;
     }
-    errno = EINVAL;
-    return 0;
+    return -EINVAL;
 
 not_there:
     not_here(name);
-    errno = ENOENT;
-    return 0;
+    return -ENOENT;
 }
 
 /* 
