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

Hi Monks,

I have tried to install DateTime module in my Unix machine.During installation it asked some supporting module like Time::Zone,Schedule-Util etc...Finally the installation is completed successfully.But when I use the module in the script it is showing the following error,
<erster@chloce:>perl date.pl Can't locate loadable object for module DateTime in @INC (@INC contain +s: /usr/perl5/5.6.1/lib/sun4-solaris-64int /usr/perl5/5.6.1/lib /usr/ +perl5/site_perl/5.6.1/sun4-solaris-64int /usr/perl5/site_perl/5.6.1 / +usr/perl5/site_perl /usr/perl5/vendor_perl/5.6.1/sun4-solaris-64int / +usr/perl5/vendor_perl/5.6.1 /usr/perl5/vendor_perl .) at /usr/perl5/s +ite_perl/5.6.1/DateTime.pm line 48 BEGIN failed--compilation aborted at /usr/perl5/site_perl/5.6.1/DateTi +me.pm line 48. Compilation failed in require at date.pl line 1. BEGIN failed--compilation aborted at date.pl line 1.
So i tried to download its previos version from CPAN and after installation of that,the error is coming in 48 line and is different one in XSLoader.pm ,see below,
<erster@chloce:>perl date.pl Can't locate loadable object for module DateTime in @INC (@INC contain +s: /usr/perl5/5.6.1/lib/sun4-solaris-64int /usr/perl5/5.6.1/lib /usr/ +perl5/site_perl/5.6.1/sun4-solaris-64int /usr/perl5/site_perl/5.6.1 / +usr/perl5/site_perl /usr/perl5/vendor_perl/5.6.1/sun4-solaris-64int / +usr/perl5/vendor_perl/5.6.1 /usr/perl5/vendor_perl .) at /usr/perl5/5 +.6.1/lib/sun4-solaris-64int/XSLoader.pm line 44 BEGIN failed--compilation aborted at /usr/perl5/site_perl/5.6.1/DateTi +me.pm line 44. Compilation failed in require at date.pl line 1. BEGIN failed--compilation aborted at date.pl line 1.
In the script i gave only one line,i.e use DateTime;But I am running the same in Win32 perl by using ppm,No issues at all..Is this a bug in datetime module in perl.How can I solve this issue monks.

Thanks and Regards
madtoperl.

Replies are listed 'Best First'.
Re: Module Installation Issue in perl
by Khen1950fx (Canon) on Jul 01, 2006 at 08:33 UTC
    It looks to me as if the XSLoader module is looking for a specific version number. I checked the Makefile.PL for DateTime module, and under PREREQ_PM it mentions DateTime::TimeZone => 0.38. I had the same problem when I installed it. So, first, go over the Makefile.PL and make note of all the prereq's and version numbers. Second, reinstall all the deps with the required version numbers. Then reinstall DateTime. It should work then. Good Luck!
        Thanx for the reminder, Joost. I installed the prereqs via CPAN, but that didn't work...In theory, the highest version number will work. I've only had a handful of modules where I had to use the exact version mentioned in the prereqs. This particular module was one of them.
Re: Module Installation Issue in perl
by jdtoronto (Prior) on Jul 01, 2006 at 17:05 UTC
    I am stretching recollections here, but I notice the OP is using Solaris. If he is using the version of Perl supplied by Sun, then it will probably have been compiled with their compiler. I recall that unless we had the same Sun compiler that was used to compile Perl we had to recompile Perl (using gcc) and then we could install modules using CPAN.

    Of course I could be totally off beam, and often am!

    jdtoronto

Re: Module Installation Issue in perl
by CountZero (Bishop) on Jul 01, 2006 at 08:22 UTC
    Did you install all the dependent modules it asked for? From the error message it looks to me that something went wrong with the compiled XS-code (hence also the XSLoader error).

    I would just delete the DateTime module and re-install it and see what it says.

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

      Hi,

      I installed it without any issue in winperl.
    A reply falls below the community's threshold of quality. You may see it by logging in.