almaler has asked for the wisdom of the Perl Monks concerning the following question:

First please let me apologize to all of you Perl experts. I have been tasked with modifying a perl script that was written by someone else several years ago and I know absolutely nothing about Perl. I wouldn't have the first clue of how to take this script and make it the minimum test case either. So, any assistance anyone can provide is greatly appreciated because I am way out of my league here and I know it.

Without posting the entire script, the requirement I was given was to remove the lines of the script that were generating log files and recompile the script as an executable. This actually seemed fairly straightforward to me and I removed the following lines from the script:

Dump_log => 'j:\\Dumplog.txt', Input_log => 'j:\\Inputlog.txt', Output_log => 'j:\\Outputlog.txt');

The problem I am now running into is trying to run the script using perl. I thought it had to do with me removing the three lines, but I cannot even run the original script. When I type in "perl myscript.pl" at the command line, I receive the following error:

PerlIO::scalar object version 0.05 does not match $PerlIO::scalar::VER +SION 0.02 at C:/Perl5.8/lib/XSLoader.pm line 88. Compilation failed in require at C:/Perl5.8/lib/Config/IniHash.pm line + 6. BEGIN failed--compilation aborted at C:/Perl5.8/lib/Config/IniHash.pm +line 6. Compilation failed in require at myscript.pl line 1. BEGIN failed--compilation aborted at myscript.pl line 1.

Any assistance is greatly appreciated!

Replies are listed 'Best First'.
Re: Receiving Error when running script
by mr_mischief (Monsignor) on Sep 19, 2007 at 17:40 UTC
    In short, this is a perl and module installation error more than something to do with the code.

    You need a newer (Update: or fixed) version of something, and that something is probably a module. Updated: Whenever you see VERSION or a version number mentioned in an error, you either have an older version of something installed than what you need, or a module is installed incorrectly.

    It could be something called like this:

    use <ModuleName> <version.number>;
    or
    use <ModuleName> <version.number> qw( import these things );
    Update:or it could mean a module is completely broken in your installation.

    Update: The next section doesn't help with module installations being completely broken, which as ikegami points out is the culprit here.

    See use and maybe require. Especially the part where the docs for use() state:
    If the VERSION argument is present between Module and LIST, then the "use" will call the VERSION method in class Module with the given version as an argument. The default VERSION method, inherited from the UNIVERSAL class, croaks if the given version is larger than the value of the variable $Module::VERSION.

    Your particular issue appears (from a glance) to be with IO::Scalar, but the same issue happens with different modules, so the method is more important in the long run than the specifics. It appears further that from a quick look as IO::Scalar's docs on CPAN that it is part of the IO::Stringy package. Update: My glance was wrong. It's PerlIO::scalar in question, as ikegami pointed out.

    Update: as ikegami points out, you can't just copy files around without paying attention to some restraints. Doing so will break things and give you this type of error.

      I don't think so. A required version mismatch would look like the following:

      >perl -e "use CGI 9.99 CGI version 9.99 required--this is only version 3.20 at -e line 1. BEGIN failed--compilation aborted at -e line 1.

      Looks more like a descrepency between the version of the .pm and the associated XS object file(.so/.dll).

      Also, the error is for PerlIO::scalar, not IO::Scalar. Since PerlIO::scalar is a core module it means his Perl installation is messed up.

        When I installed a Perl5.8 under C:\Perl5.8, I had modules under the c:\Perl\lib which was a previous version. I copied module folders such as Config\Hash from c:\Perl\lib to c:\Perl5.8\lib. Could that be the issue? Do I need to download newer modules of everything?
        Thanks for pointing those out. When I said, "from a glance", I guess I meant it more literally than I thought.

        Update:

        the original node I posted is now updated to show the shortcomings ikegami pointed out in it. Hopefully that will keep it from confusing anyone.
      In the script, I have found the following "use" statements, but I did not find any "require" statements.
      use Config::IniHash; use Win32:GUI; use Net::Telnet; use Hash::Case; use Net::Telnet ();
      So, I need to download these modules?