2
votes

I am trying to run a Perl script as a CGI script. When I run the perl script from cmd line, it runs perfectly well, but it shows the following error when I run it from my browser.

Storable object version 1.012 does not match $Storable::VERSION 1.010 at
C:/Perl/lib/DynaLoader.pm line 225.
Compilation failed in require at C:/Perl/site/lib/AsiaXMLUtils.pm line 20.
BEGIN failed--compilation aborted at C:/Perl/site/lib/AsiaXMLUtils.pm line 20

The perl script concerned has basically been designed to queue some job to a remote software. In case it rings a bell, Line 20 in the mentioned file is :

use Storable qw(&retrieve &store);

Here are the things I have done :

  1. I have checked the following pages on how to troubleshoot your CGI script but haven't got around the problem.

  2. I have checked that the perl versions are the same for my PC as well that used for the software I am sending the script too. I guess had that been a problem, I wouldn't have been able to run the script from the commnad line either.

  3. I have run a simple Perl CGI (hello world) script using the same basic html code, so I guess that means I am not putting the cgi files (or accessing them) at the wrong places.

I am running a deadline for finishing this task, and thought should ask what approach I should take to solve such a problem. I am new to Perl. Any cues to what I should read to get around the problem will be greatly appreciated. I cannot share the code anyways, since much of it is proprietary.

3

3 Answers

2
votes

Storable is an XS module, which means that it has both C code in Storable.dll (or Storable.so on Unix) and Perl code in Storable.pm. That error indicates that the version of Storable.dll ("Storable object version 1.012") does not match Storable.pm ("$Storable::VERSION 1.010"). If you can run the script from the command line, that means that your webserver is either using a different version of Perl, or @INC is different, or possibly you have an extra Storable.dll in your webserver's directory.

1
votes

Try to use nstore instead of store. This way, your file will be crossplatform. Also, try to reinstall the Store module.

0
votes

Here is how I was able to solve the issue, which btw wouldn't have been possible without the valuable inputs of Miguel Prz and cjm.

  1. Regarding the Storable Module : After reading both the answers, I noticed that my pc had two versions of Perl. I removed one of them. This got me around the "Storable object version 1.012 does not match $Storable::VERSION" error. Sounds pretty lame, I know. But I thought I should let you know anyways. But then I ran into another set of problems. This :

    Can't locate AJE/Constants.pm in @INC (@INC contains: C:/Perl/lib C:/Perl/site/lib .)

  2. From comparing with the @INC of the perl environment from the command line (for which I found this SO post very useful), I noticed that the @INC that my web server was using (consisting of only 2 directories as shown above) did not include many of the directories in the @INC of the command line perl environment. This is where cjm's words came back to me! I then used use lib to add those files in my perl script and that solved the problem!

Thank you for all the help!