74

Until now I used ActiveState's ActivePerl, and used the ppm for installing modules.

Last week I moved to Strawberry Perl, but I don't know how I should install modules using Strawberry Perl. What is some information on how module installation is done using Strawberry Perl or is there some link on how to install new modules?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
ronssd
  • 741
  • 1
  • 5
  • 3

4 Answers4

68

You can still use ppm, but it is not recommended. Run CPAN client from the Strawberry Perl or Strawberry Perl (64-bit), sub folder Tools, entry in the Start menu.

Type install Module::Name there.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Alexandr Ciornii
  • 7,346
  • 1
  • 25
  • 29
42

As Alexandr says, you can use the CPAN client via the start menu. You can also install modules just as you would on Unix from the DOS window:

perl -MCPAN -e shell
install Quantum::Entanglement

You can also download the .tar.gz from CPAN, unzip it and install as you would in Unix:

cd Module-Name-1.23
perl Makefile.PL
dmake
dmake test
dmake install

You may need to make sure your %PATH% environment variable has the right entry to get to Strawberry Perl, and does not contain other copies of dmake or gcc, which will sometimes lead to headaches.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Alex
  • 5,863
  • 2
  • 29
  • 46
  • 3
    "cpan" is shorter than "perl -MCPAN -e shell" – Alexandr Ciornii Jul 11 '11 at 01:59
  • 2
    well, yes, but I like to be able to check perl -v first to know which Perl I'm running. – Alex Jul 11 '11 at 02:22
  • 6
    you can do it in one line: `cpan Quantum::Entanglement` – Kai Carver Aug 24 '13 at 12:48
  • 3
    also you can use `cpanm` instead of `cpan`. `cpanm` might be better if you are new to this, as it has less messages and configuration. – Kai Carver Aug 24 '13 at 12:58
  • The *`You may need to make sure [...]`* considerations only apply to the second version, right? – Wolf Feb 23 '17 at 16:30
  • As Alex said, it works fine with: cd Module-Name-1.23 perl Makefile.PL dmake dmake test dmake install `dmake` is a `make` program that happens to run pretty well on Windows, as described [here](http://stackoverflow.com/questions/2777261/what-is-dmake-actually-doing-when-installing-a-new-module). – Asam Padeh May 13 '13 at 17:25
  • No, it applies to both. – Ed. Aug 31 '17 at 06:37
  • Strawberry Perl has deprecated `dmake`, and you should use `gmake` instead. – Wes Dec 09 '21 at 18:41
9

Change the directory:

cd C:\Strawberry\perl\bin

Then

C:\Strawberry\perl\bin>cpan Lingua::EN::Sentence

and the module will install automatically.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
James
  • 182
  • 1
  • 3
  • 10
3

CPAN is the easiest installation method.

As Alex has noted, you may have to download a .tar.gz and unzip it. Since he wrote his answer, Strawberry Perl has deprecated dmake, and you should use gmake instead.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Wes
  • 423
  • 3
  • 12