In an AUTOLOAD routine I get a mysterious 'No such file or directory' error message. I need some help to interpretit.
I still have not managed to manually make the DBD::DB2 package as described in Node DBD::DB2 with ActiveState Perl 5.12 on Windows. But this time I am a bit further. The compile seems to be correct and the problem has to do with 'use autoload' and defining a standard AUTOLOAD procedure. So what have I done.
First made all fresh from a DBD-DB2-1.82 download from CPAN and debugged into DBD::DB2::Constants::AUTOLOAD (line 1572). This routine is more or less exactly, what the docs gave as an example. Debugging gave me the following:
DB<4> c DBD::DB2::Constants::AUTOLOAD(blib\lib/DBD/DB2/Constants.pm:1572): 1572: my $val = constant($constname, @_ ? $_[0] : 0); DB<4> p $constname SQL_PARAM_INPUT_OUTPUT DB<5> l 1572==>b my $val = constant($constname, @_ ? $_[0] : 0); 1573: if ($! != 0) { 1574: if ($! =~ /Invalid/) { 1575: $AutoLoader::AUTOLOAD = $AUTOLOAD; 1576: goto &AutoLoader::AUTOLOAD; 1577 } 1578 else { 1579: croak "Your vendor has not defined DBD::DB2::C +onstants macro $constname"; 1580 } 1581 } DB<5> n constant 'SQL_PARAM_INPUT_OUTPUT',0 Now I'm here and return 2 DBD::DB2::Constants::AUTOLOAD(blib\lib/DBD/DB2/Constants.pm:1573): 1573: if ($! != 0) { DB<5> p $! No such file or directory DB<6> p $val 2 DB<7>
This looks like the Constants.xs works as expected (I introduced the two additional output lines), it returns the correct value for the constant, but the '$!' makes no sense. That lets the code jump into the 'undefined macro' branch and fail. Where does this come from? As the /Invalid/ condition shows there seem to be similar cases. Did anybody see this before?
I work on a German Windows XP machine with Visual C and ActiveState Perl. I tried Perl versions 5.8, 5.10 and 5.12 (5.14 not yet). All selfmade DBD::DB2 modules behave the same under these environments. The premade PPM from one of the repositories for 5.8 and 5.10 returns an empty string for $! and therefore works. But I still have not found a ppm for newer Perl versions containing the DB2 module yet.
Any help is appreciated.
And it came to pass that in time the Great God Om spake unto Brutha, the Chosen One: "Psst!"
(Terry Pratchett, Small Gods)
In reply to Problem with AUTOLOAD and Windows by Brutha
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |