http://www.perlmonks.org?node_id=985648

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

Hi All, I am new to perl and I am stuck on what seems to be a very basic thing. I had to work on a issue which deals with reading of Excel files in Perl. Currently, the application uses Spreadsheet::ParseExcel and reads Excel files with xls etension only (97 2003 format) but going forward, we have to read files with xlsx extension also. I studied that for doing this, we have to use Spreadsheet::XLSX package. But it seems i did not install the package correctly. I downloaded the tar files, unzip them n copied to my perllib directory. and when i tried testing my perl script, it gave me the following error -

Can't load '../perldir/auto/Compress/Raw/Zlib/Zlib.so' for module Comp +ress::Raw::Zlib: ld.so.1: perl: fatal: ../perldir/auto/Compress/Raw/Z +lib/Zlib.so: wrong ELF data format: ELFDATA2LSB at /usr/perl5/5.8.4/l +ib/sun4-solaris-64int/DynaLoader.pm line 230. at ../perldir/Archive/Zip.pm line 9 Compilation failed in require at ../perldir/Archive/Zip.pm line 9. BEGIN failed--compilation aborted at ../perldir/Archive/Zip.pm line 9. Compilation failed in require at ../perldir/Spreadsheet/XLSX.pm line 1 +1. BEGIN failed--compilation aborted at ../perldir/Spreadsheet/XLSX.pm li +ne 11. Compilation failed in require at excel2txt_venky.pl line 7. BEGIN failed--compilation aborted at excel2txt_venky.pl line 7.

Though the file - Zlib.so is available in the directory - ../perldir/auto/Compress/Raw/Zlib/ with all the permissions.

I am doing this on Solaris 10 with Perl, v5.8.4.

Please let me know where am I wrong and how to work on this. Quick reply is appreciated.

Thank you everyone.

Venky

Replies are listed 'Best First'.
Re: Problem with Spreadsheet::XLSX..
by Corion (Patriarch) on Aug 06, 2012 at 10:27 UTC
    Can't load '../perldir/auto/Compress/Raw/Zlib/Zlib.so' for module Compress::Raw::Zlib: ld.so.1: perl: fatal: ../perldir/auto/Compress/Raw/Zlib/Zlib.so: wrong ELF data format: ELFDATA2LSB

    It seems that your Perl installation finds the wrong Zlib (or Compress::Zlib libraries. Potentially it finds the libraries for a different architecture.

    I suggest consulting with your system administrator about the best way forward and recommend that you learn about how to properly install modules.

    Manually copying files is not the proper way to install Perl modules. See local::lib, perlbrew and Yes, even you can use CPAN for approaches how to maintain your own Perl library separate from the libraries provided by the system.

      Thank Corion for your quick reply.

      But i was unzipping n copying the files in the same directory from where it was picking the files for Spreadsheet::ParseExcel.

      I have little help from others and basically I am on my own. :) with offcoz the help from this forum.

      It wud be a great help if you cud let me know the steps in which I can install the module correctly.

      Thanks. Venky

        I linked to various educative nodes. Please read them and apply their contents to your situation.

        If you have no system administrator to talk to about the architecture and operating system, this is even more reason to use your own version of Perl and/or your own Perl library instead of using the libraries provided by the operating system. You will have to learn about the operating system you are working on. I cannot help you there.

Re: Problem with Spreadsheet::XLSX..
by marto (Cardinal) on Aug 06, 2012 at 10:52 UTC

    "I downloaded the tar files, unzip them n copied to my perllib directory."

    This isn't a sensible way to install modules. Use cpan Spreadsheet::XLSX to install the module and it's prerequisites correctly.

    I suggest setting up your own Perl on the system, and avoid using the system Perl which ships with Solaris. First of all Solaris uses this for some OS tasks and it's best left alone, secondly 5.8.4 is very old. See App::perlbrew for an easy way to achieve this.

      Thank you Corion and Marto .. i am going through the links provided. :)

      Thank you.

      Venky

        One more question,

        how would i know which all are the current libraries used by Perl and where is it installed.

        I mean everything about the current Perl that I have on my system.

        Venky