in reply to Problem with AUTOLOAD and Windows

It seems that the C code uses $! as an (ill-advised) way to communicate "constant not found" to the caller, instead of die-ing right from the C code. The C code seems to set $! to ENOENT, so the most consistent way to handle that from the Perl code would be to check $! for ENOENT instead of trying to do string matching:

... manually coded string lookup table ... not_there: errno = ENOENT; return 0; }

I would look towards POSIX to get at the value of ENOENT for your OS, and then use that for the comparison.

Replies are listed 'Best First'.
Re^2: Problem with AUTOLOAD and Windows
by Brutha (Friar) on Nov 23, 2011 at 12:59 UTC

    The AUTOLOAD part of the code did not change from the first CPAN version of this module 11 years ago as is more or less the same as advised cpan-AutoLoader. Nevertheless, the constant is found. Here are my trace modifications from the XS:

    static double constant(name, arg) char *name; int arg; { errno = 0; printf ("constant '%s',%d\n", name, arg); switch (*name) { ... if (strEQ(name, "SQL_PARAM_INPUT_OUTPUT")) #ifdef SQL_PARAM_INPUT_OUTPUT printf("Now I'm here and return %d\n",SQL_PARAM_INPUT_OUTPUT ) +; return SQL_PARAM_INPUT_OUTPUT; #else goto not_there; #endif ...

    Otherwise this is unmodified code from CPAN (or IBM as You like).

    This code should work, it has to be either with my local (missing) configuration, localization or ... well, I have no clue.

    And it came to pass that in time the Great God Om spake unto Brutha, the Chosen One: "Psst!"
    (Terry Pratchett, Small Gods)