vinoth.ree has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I have been asked to move from ActiveState old perl version 5.8.8 to Strawberry Perl 5.32. So I uninstalled activestate perl and installed Strawberry perl.

I am trying to install the additional required modules using cpan command, but getting below error.

C:\Users\vinothg>cpan Tk Loading internal logger. Log::Log4perl recommended for better logging CPAN: CPAN::SQLite loaded ok (v0.219) Database was generated on Mon, 09 Jan 2023 06:01:06 GMT >(error): Could not expand [Tk]. Check the module name. >(info): I can suggest names if you install one of Text::Levenshtein:: +XS, Text::Levenshtein::Damerau::XS, Text::Levenshtein, and Text::Leve +nshtein::Damerau::PP >(info): and you provide the -x option on invocation. >(error): Skipping Tk because I couldn't find a matching namespace.

All is well. I learn by answering your questions...

Replies are listed 'Best First'.
Re: Unable to install Tk module for Strawberry Perl
by LanX (Saint) on Jan 09, 2023 at 16:53 UTC
    > So I uninstalled activestate perl and installed Strawberry perl.

    you probably still have remains of the Activestate installations in your environment.

    Better check where cpan and where perl and PATH and all other ENV-vars containing "PERL".

    Cheers Rolf
    (addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
    Wikisyntax for the Monastery

      Hi Lanx

      By default the strawberry perl path is not added into PATH env variable. I have add it manually.

      C:\Users\vinothg>where perl C:\Strawberry\perl\bin\perl.exe
      C:\Users\vinothg>where cpan C:\Strawberry\perl\bin\cpan C:\Strawberry\perl\bin\cpan.bat

      All is well. I learn by answering your questions...
        Please note that even after adding a new installation, configs of an old one can interfere. They must be purged.

        Cheers Rolf
        (addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
        Wikisyntax for the Monastery

        By default the strawberry perl path is not added into PATH env variable

        Are you sure?

        I've installed Strawberry Perl a couple of times recently. One Windows 10 desktop and one Windows 11 laptop. In neither case did I have to set the PATH variable. I did have to change the association of *.pl and *.pm from perl.exe to a text editor.

        I'm not near either of those machines right now. But this Windows 10 machine has Strawberry Perl installed and there are 3 Strawberry Perl paths in PATH. It was installed a long time ago but I don't recall setting PATH manually.

Re: Unable to install Tk module for Strawberry Perl
by Discipulus (Canon) on Jan 10, 2023 at 07:51 UTC
    Hello,

    if LanX is correct in his answer then you can give a try to srtawberry portable edition which comes with portableshell.bat a small launcher that build up a clean PATH for you. Use directly this distro or use it as comparison test to spot the differences with the other one. Pay attention to have and use the right make incarnation: where gmake should return a path inside the strawberry one you are using, like x:\some\where\perl5.26.64bit\c\bin\gmake.exe

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
      ... give a try to strawberry portable edition which comes with portableshell.bat a small launcher that build up a clean PATH for you.

      Good advice. I've lost count of the number of times that the answer to a Strawberry Perl question on this forum has been "use the portable edition".
      It made me wonder why Strawberry Perl promoted the msi edition as the "Recommended version" ...so much so that I decided to "poke the bear".

      Cheers,
      Rob
        I would guess that the "typical" Windows user of Perl would prefer the MSI version because it will automatically associate .pl files with perl.exe thereby allowing them to double-click the script to run it. (And sadly, many Windows users, probably even many who have enough skills to write a simple script in perl, or at least copy/paste it, wouldn't know how to do manual associations in Windows without an MSI or installer-exe to do it for them.)

        Personally, I use one of the PDL-portable copies of Strawberry with manual file associations, because I like the double-click, but I really want all those extra math libraries that come in that bundle that aren't in the normal MSI or portable Strawberries.

        "poke the bear"

        I'd much rather that they keep their focus on figuring out how to build newer versions of perl, so that we could get strawberry versions of 5.34 and 5.36. (Commit messages from November seem to indicate they are at least working on 5.34, but it seems to have paused again.)

        It made me wonder why Strawberry Perl promoted the msi edition as the "Recommended version" ...so much

        I think it's because strawberry perl use a hacky way to make perl portable. IIRC, it modify Config infomation in run time by a module named Portable. use




        I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction

      Hi Discipulus,

      I have install the strawberry perl by downloading the strawberry-perl-5.32.1.1-64bit.msi from https://strawberryperl.com/ only.


      All is well. I learn by answering your questions...
Re: Unable to install Tk module for Strawberry Perl
by KeighleHawk (Scribe) on Jan 20, 2024 at 21:04 UTC

    I realize this is an old thread, but I don't feel like you really got an answer and I just ran into this. I'm not sure I have a complete answer, except to say I have successfully installed Strawberry Perl and Perl/Tk on two Windows 10 laptops. Things to note

    1. I used Strawberry Perl 5.32.1 64 bit (as I believe you did). I only mention this because I tried installing Tk with 5.38 and it failed for reasons I am still looking into. I did not try 5.36.
    2. On my Lenovo Helix, 2 out of 4k+ tests failed so I had to actually use the --force option. On my Lenovo W520 (months later) all tests passed.
    3. The one difference I did see between what you did and what I did (unless it was a typo) is that I used cpanm rather than cpan. I can't tell you why I did that. I believe I researched it at the time (having been out of Perl programming for a while) and intentionally chose to use cpanm.
    4. I blogged about it here (https://doersofstuff.org/2023/05/15/picking-perls-in-a-strawberry-patch/) if you want to see the whole thing.

    Hopefully that helps you (or anyone else who stumbles onto this). Hopefully I'll get a chance to look into the issue I had 5.38.

        This doesn't help me install Tk under Strawberry Perl 5.38.2. Issuing the command cpan Tk or any other variation thereof, cranks through the usual thousands of lines of incomprehensibility, including some red errors early on, maybe on something named "pmop" or something like that... But the real point of failure is this incomprehensible C compilation error:
        gcc -c -I. -I./pTk/mTk/xlib -I.. -I.. -I../pTk/mTk/xlib -I. -Ibitmaps + -I.. -I../pTk/mTk/xlib -DWIN32 -DWIN64 -DPERL_TEXTMODE_SCRIPTS -DMUL +TIPLICITY -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D__USE_MINGW_ANSI_STDIO - +fwrapv -fno-strict-aliasing -mms-bitfields -DPERLDLL -Os -falign-func +tions -falign-jumps -falign-labels -falign-loops -freorder-blocks -fr +eorder-blocks-algorithm=stc -freorder-blocks-and-partition -DVERSIO +N=\"804.036\" -DXS_VERSION=\"804.036\" "-IC:\STRAWB~1\perl\lib\CORE" + imgBMP.c In file included from ../pTk/mTk/xlib/X11/Xlib.h:31, from tkWinPort.h:19, from tkPort.h:32, from tk.h:87, from imgBMP.c:11: ../pTk/mTk/xlib/X11/X.h:182:34: error: expected identifier or '(' befo +re numeric constant 182 | #define ControlMask (1<<2) | ^
        This is very strange as this is the third successive line of pretty much the same format: "#define _____ (1<<_)" , but the first two lines are apparently acceptable as they stand. The only outstanding difference in this line is that "ControlMask" as a string is long enough that it moves the definition "(1<<2)" to the next tab stop, as compared to the two preceding lines. I also can't reproduce the error in a simple test program that simply does a "#include tk.h".