Robert DiRosario
Robert DiRosario

Reputation: 33

Installing Switch.pm in Active perl on windows 10

I'm trying to get a Perl script running on Windows 10 with Active Perl 5.28.1. It currently runs on windows 7 with Active Perl 5.8.8. When I try to run it I get:

Can't locate Switch.pm in @INC (you may need to install the Switch module) (@INC contains: C:\Perl\lib C:/Perl64/site/lib C:/Perl64/lib) at fds_propagator_with_collision_ephem.pl line 108.

So I tried to install Switch.pm. I started cpan and then did install Switch.pm

I got:

C:\Users\rdirosar>cpan
Loading internal logger. Log::Log4perl recommended for better logging

cpan shell -- CPAN exploration and modules installation (v2.20)
Enter 'h' for help.

cpan> install Switch.pm

Reading 'C:\Perl64\cpan\sources\authors\01mailrc.txt.gz'
Use of uninitialized value $command in concatenation (.) or string at C:\Perl64\lib/CPAN/Tarzip.pm line 163, <IN> line 1.

'-qdt' is not recognized as an internal or external command,
operable program or batch file.
............................................................................DONE

Reading 'C:\Perl64\cpan\sources\modules\02packages.details.txt.gz'
Use of uninitialized value $command in concatenation (.) or string at C:\Perl64\lib/CPAN/Tarzip.pm line 163.
'-qdt' is not recognized as an internal or external command,
operable program or batch file.

Warning: Your C:\Perl64\cpan\sources\modules\02packages.details.txt.gz does not contain a Line-Count header.
Please check the validity of the index file by comparing it to more
than one CPAN mirror. I'll continue but problems seem likely to
happen.
Warning: Your C:\Perl64\cpan\sources\modules\02packages.details.txt.gz does not contain a Last-Updated header.
Please check the validity of the index file by comparing it to more
than one CPAN mirror. I'll continue but problems seem likely to
happen.
.Could not split line["┬0\cL²\cU\c?└'≈\cCé"]

Could not split line["c▐X'Γπ"├█\cP\cE?▀&δ┌╠5α%â╛mτl∞Bô⌠ñg▒R\cI¥\cT\cP╘≈\cX."]


Could not split line["V╟\c]\$≈»1"]

Could not split line["a\cVk\cQ0y│ôδNj+╒1<c;¼òPb╪Zà⌠∞\cBl≥┤h\cRU\cPFÄ┴▄4û\cIƒ\@⌐╜─b*QZ\$lEX╞╔■î>∩îÅ=\cF┬N;│¼-\cZu¿fÆh\eD"]

Giving up parsing your C:\Perl64\cpan\sources\modules\02packages.details.txt.gz, too many errorsReading 'C:\Perl64\cpan\sources\authors\01mailrc.txt.gz'

Use of uninitialized value $command in concatenation (.) or string at C:\Perl64\lib/CPAN/Tarzip.pm line 163.


'-qdt' is not recognized as an internal or external command,
operable program or batch file.
............................................................................DONE

Reading 'C:\Perl64\cpan\sources\modules\02packages.details.txt.gz'

Use of uninitialized value $command in concatenation (.) or string at C:\Perl64\lib/CPAN/Tarzip.pm line 163.


'-qdt' is not recognized as an internal or external command,
operable program or batch file.

Warning: Your C:\Perl64\cpan\sources\modules\02packages.details.txt.gz does not contain a Line-Count header.

Please check the validity of the index file by comparing it to more
than one CPAN mirror. I'll continue but problems seem likely to happen.

Warning: Your C:\Perl64\cpan\sources\modules\02packages.details.txt.gz does not contain a Last-Updated header.

Please check the validity of the index file by comparing it to more
than one CPAN mirror. I'll continue but problems seem likely to
happen.

.Could not split line["┬0\cL²\cU\c?└'≈\cCé"]

Could not split line["c▐X'Γπ"├█\cP\cE?▀&δ┌╠5α%â╛mτl∞Bô⌠ñg▒R\cI¥\cT\cP╘≈\cX."]

Could not split line["V╟\c]\$≈»1"]

Could not split line["a\cVk\cQ0y│ôδNj+╒1<c;¼òPb╪Zà⌠∞\cBl≥┤h\cRU\cPFÄ┴▄4û\cIƒ\@⌐╜─b*QZ\$lEX╞╔■î>∩îÅ=\cF┬N;│¼-\cZu¿fÆh\eD"]

Giving up parsing your C:\Perl64\cpan\sources\modules\02packages.details.txt.gz, too many errorsLockfile removed.

C:\Users\rdirosar>

I tried deleting the files in: C:\Perl64\cpan\sources\authors and C:\Perl64\cpan\sources\modules\ That had no effect, if there are files in the directories they are updated as needed.

What am I doing wrong? Robert

note: I found I needed to add some cr/lf to the text, otherwise I would get a error message about code not being formated correctly.

Upvotes: 3

Views: 2764

Answers (1)

Kjetil S.
Kjetil S.

Reputation: 3787

According to https://www.activestate.com/blog/goodbye-ppm-hello-state-tool/ ActivePerl 5.28 has removed the old PPM interactive GUI module installation tool in favor of the new https://platform.activestate.com/ website where you log in, pick modules, builds, waits and finally downloads your own custom runtime as one big .exe or .msi file (on windows anyways).

This installation file includes ActivePerl 5.28 and the modules you picked.

In my test on Windows 10 the Switch module was installed without trouble like this.

Other alternatives might be:

  • Perl 5.26 where PPM a is still available I think, find it at activestate.com
  • use the CPAN command from 5.28, but for many if not most modules you need make or dmake. The latter is perhaps easiest available through http://www.mingw.org/
  • Use WSL - windows subsystem for linux. There apt or yum or similar command for your flavour of linux are available. Easy and dependable way to install Perl modules. In my experience. But this isn't ActivePerl, it's barely Windows, it's mostly Gnu/Linux
  • Strawberry-Perl for Windows
  • Switch seems to be (judging by a very quick glance now) just a pure perl module that does not depend on other non-core modules. So you can just download the file from https://fastapi.metacpan.org/source/CHORNY/Switch-2.17/Switch.pm and place it in one of the folders output from perl -le'print for @INC' and make sure the file is readable by the system user.

Upvotes: 3

Related Questions