Perl Module XML::Expat won’t dynamicall load under IIS 7 and Windows 2008

cgiiis-7perlwindows-server-2008

We're moving our old Perl/CGI application to a new system internally and ran into a snag. When I run:

 perl -MXML::Parser -e 1

From the command line, all is well. However, when I run it from a CGI script as use XML::Parser, all hell breaks lose:

Can't load
'C:/strawberry/perl/site/lib/auto/XML/Parser/Expat/Expat.dll'
for module XML::Parser::Expat:
load_file:The specified module could
not be found at
C:/strawberry/perl/lib/DynaLoader.pm
line 200, line 55. at
C:/strawberry/perl/site/lib/XML/Parser.pm
line 18 Compilation failed in require
at
C:/strawberry/perl/site/lib/XML/Parser.pm
line 18, line 55. BEGIN
failed–compilation aborted at
C:/strawberry/perl/site/lib/XML/Parser.pm
line 22, line 55. Compilation
failed in require at (eval 43) line 1,
line 55. BEGIN
failed–compilation aborted at (eval
43) line 1, line 55.

Other modules added onto the perl installation work fine (MD5, WIn32::ODBC, etc…) but this Expat one snarls.

The server is IIS 7 (new to us for this app), x64 Win2008 (also, new to us).

EDIT:

After futzing around with this for a while, this isn't the only module that fails to load. XML::Simple does as well. Almost the same error. The DLL's that Perl is claiming do not exist, exist just fine. And things work from the command line as well.

Suggestions?

Best Answer

There is a bug in the perl distribution for Windows in Cwd.pm. See https://rt.cpan.org/Public/Bug/Display.html?id=56225 for details.

The fix that worked for me is to replace this line:

if (eval 'defined &DynaLoader::boot_DynaLoader') {

with

if (eval { defined &DynaLoader::boot_DynaLoader; }) {

in sub _win32_cwd

I also found more related information here: www.epic-ide.org/faq.php#debug

Related Topic