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

I'm a beginner at installing Perl. We moved to a new server over the weekend. I've decided to stick to 32 bit version of Perl since 64 bit was giving me issues with ASP scripts. The only 32 bit my IT Admin had was 5.8.6. That's what I had him install. My OS is Windows Server 2019

Everything works okay except one script that has use Time::Piece. It gives me an error

Can't locate Time/Piece.pm in @INC (@INC contains: C:/Perl/lib C:/Perl/site/lib .) at format_schwabfile_manual.pl line 7 So I try to install it via ppm

C:\>ppm install time::Piece Error: No valid repositories: Error: 404 Not Found Error: 404 Not Found
Tried  cpan> install Time::Piece But that didn't work either. It was not able to connect to any of my URLS. So I manually download Time-Piece-1.33.tar.gz from CPAN. Now that I have the tar file, how do I manually install it?

Replies are listed 'Best First'.
Re: Installing a missing module - Perl 5.8.3
by syphilis (Bishop) on Jan 24, 2020 at 04:26 UTC
    You're much better off grabbing either strawberry-perl-5.30.0.1-32bit-portable.zip or strawberry-perl-5.30.0.1-64bit-portable.zip from http://strawberryperl.com/releases.html.
    (I can't give you the full link because I can't actually access http://strawberryperl.com/releases.html at the moment.)
    I believe that the more common choice is for the 64bit version.

    Then you just unzip the package to your choice of location, cd to that location, execute portableshell.bat .... and start running whatever perl commands you like.
    Strawberry Perl ships with latest Time::Piece so you won't even have to install it. (But even if you did have to inatall it, it's as simple as cpan -i Time::Piece)

    To answer your question:
    1) tar zxvf Time-Piece-1.33.tar.gz
    2) cd Time-Piece-1.33
    3) perl Makefile.PL
    4) nmake test
    5) nmake install

    You'll need a Microsoft C compiler, and also nmake (which will probably ship with the package that contains the C compiler).

    You may need that Microsoft Compiler to be VS 6.0, as that's the compiler that built your perl 5.8.6. (OTOH, other more recent versions of Microsoft compilers might suffice.)
    If you run cl you can see the version of the compiler that you have. For VS 6.0, it will be 12.00.something:
    C:\>cl Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80 +x86 Copyright (C) Microsoft Corp 1984-1998. All rights reserved. usage: cl [ option... ] filename... [ /link linkoption... ]
    Cheers,
    Rob

      If you upgrade that far, you may find you need to change all scripts & modules to use lib '.';. I have that scar, but no others, from a recent major upgrade.

      Regards,

      John Davies

Re: Installing a missing module - Perl 5.8.3
by kcott (Bishop) on Jan 24, 2020 at 03:30 UTC

    G'day amitvalia,

    Time::Piece was added in Perl v5.10 (see perl5100delta: New modules) which is why it wasn't available in your v5.8.6.

    I see the documentation has information relating to Win32 and 32-bit Perl: both in the CAVEATS section.

    When you unpack Time-Piece-1.33.tar.gz, I'd expect there to be files like README and INSTALL which explain how to do the installation. I've never used Windows Server 2019 so I can't provide any direct help; perhaps another monk has experience in this area. I will note that any commands using make typically need something else for Win32 (e.g. dmake) but I don't have specific knowledge to aid you.

    — Ken

Re: Installing a missing module - Perl 5.8.3
by Anonymous Monk on Jan 24, 2020 at 02:42 UTC

    Hi

    Error: No valid repositories:

    Solution is obvious, add ppm repositories

    Tried cpan> install Time::Piece But that didn't work either.

    *yawn* If you copy/paste the error message, a solution is not far behind

    The only 32 bit my IT Admin had was 5.8.6. My OS is Windows Server 2019

    LOL

      One of the following is true:

      A module compiled with 5.8.6 works with Perl 5.8.3, all else being equal.

      A module compiled with 5.8.3 works with Perl 5.8.6, all else being equal.

      I don't remember which. Maybe someone can remind me?

      The point is that a module for the wrong version might still work for you.

      (Oops, was meant to be a reply to the OP.)

        AIUI, an extension compiled with 5.x.a is guaranteed to work with 5.x.b if and only if a <= b && $Config{archname} has not changed.
        So, yes - a build of Time::Piece that was compiled with perl-5.8.3 should be fine with perl-5.8.6.
        It's highly unlikely that Windows builds of perl-5.8.3 and perl-5.8.6 would differ in $Config{archname}.

        Cheers,
        Rob