Saturday, January 17, 2009

Install Strawberry Perl on your Windows computer

As I mentioned before, you have selected the Strawberry Perl distribution to be the environment of choice for this blog project. The nal tally is:
- 4 votes for ActivePerl
- 8 votes for Strawberry Perl
- 4 voters didn't care one way or the other.

You can download here version 5.10.0.3 of the Strawberry Perl distribution for Windows.

Strawberry Perl installer iconDouble-click on strawberry-perl-5.10.0.3.exe to start the install process.
On Vista, you will need to authorize the installation process.
The configuration is pretty straightforward. A "C:\strawberry" folder will be created.


If you selected to create an entry to the Windows program manager, you will find there:
On your computer, the files in the C:\strawberry directory are organized in that fashion:
  • \c
--> contains tools to build modules found on CPAN
  • \cpan
--> where your CPAN modules will be installed.
  • \licences
--> Gnu GPL (General Public License). This is the base of the open source philosophy. It basically says that software distributed under the GPL must include its source code. Any modification of the source and redistribution is allowed but the modified source must also be made public.
  • \perl
--> \perl\bin contains the perl.exe interpreter.
--> \perl\lib contains the perl core source files and all the base perl modules.
  • \win32
--> has the four web links cited above.

In order to see if the interpreter is installed correctly, open a command shell: Windows Start Menu -> type cmd.exe in the Search box for Vista (Run box for XP)
Check that c:\strawberry\perl\bin has been added at the end of your path by typing:
path
at the DOS prompt.

Finally, type
perl -v
and make sure you get a message similar to the one below (click on image to zoom).

perl -v output
Congratulations! Perl is now installed on your machine.

French expression of the day:
"Tout vient à point à qui sait attendre": All things come to those who wait.

Next posts:
  • Hello World program
  • More about CPAN
  • Perl development tools - Part II: setting up your environment
  • How to install Google Analytics on your Blogger blog
  • First version of FileInfo script

10 comments :

  1. Damien,

    What Perl distribution is your preference and why? I'm just curious, as I've only really used ActivePerl and I'm wondering what the benefits are to go with other distributions.

    Thanks,

    --Ken

    ReplyDelete
  2. Ken,

    I started out using ActivePerl because it was the only distribution available on windows at the time. I never used their rpm system, each time downloading then compiling CPAN modules by hand with the help of NMAKE.
    When I tried Strawberry Perl, I was impressed by the easy build process: open a cpan shell and just type "install ModuleName".
    I believe ActivePerl comes with Windows librairies pre-installed but not all CPAN modules are supported.

    ReplyDelete
  3. How do I compile a perl file with a batch file?

    ReplyDelete
  4. damien! I cannot code and computer jargon means nothing to me, and I am trying to learn perl. Plaese help. what do you do if, in the command shell, i type path the perl -v and don't get the message shown above? (its not recognised as a internal or external command, operable program etc). I guess this means its not installed correctly, but the c:\strawberry folder is there and full of all it should be. What is going on?

    ReplyDelete
  5. Check that c:\strawberry\perl\bin has been added at the end of your path by typing:
    path
    in the command shell.
    It is probably missing and you can add it by typing
    path=%PATH%;c:\strawberry\perl\bin

    If that solves your problem, then you need to add the perl path to your Windows' Path environment variable. To do so: Open the System Properties form (keyboard shortcut=Windows button + Break button) -> Advanced Params -> environment variables. Edit the 'Path' variable and add ";c:\strawberry\perl\bin" at the end (still without the quotes).

    Good luck and don't give up!

    ReplyDelete
  6. Thanks for the info....I was trying to installed this and kept having problems with the installer...your instructions worked great. I'm up and running!

    ReplyDelete
  7. when i type perl -v i receive the following error:
    'perl' is not recognized as an internal or external command...
    what else should i check aside from the Windows Path environment variable (it is set correctly)?

    ReplyDelete
  8. Hello Damien,

    Quick question. If you install a new module from Cpan after installing Strawberry in your windows, where does the new module go?
    For example, I installed String::Similarity in my Windows 7 box, and then tried to find out where the module actually is, but I did not find any.

    FYI: my @INC:
    %ENV:
    PERL="C:\Perl"
    CYGWIN="c:\cygwin"
    @INC:
    /usr/lib/perl5/5.10/i686-cygwin
    /usr/lib/perl5/5.10
    /usr/lib/perl5/site_perl/5.10/i686-cygwin
    /usr/lib/perl5/site_perl/5.10
    /usr/lib/perl5/vendor_perl/5.10/i686-cygwin
    /usr/lib/perl5/vendor_perl/5.10
    /usr/lib/perl5/vendor_perl/5.10
    /usr/lib/perl5/site_perl/5.8
    /usr/lib/perl5/vendor_perl/5.8

    ReplyDelete
  9. Damien,
    Thanks for the info on verifying perl software install.i am done, plz say me the steps which i must use to execute a perl script using this straberry, i am new to perl plz guide me.

    ReplyDelete
  10. when i type source in cmd it shows perl file but when i type perl -v it is telling its perl.exe is not valid win 32 application what should i do ?

    ReplyDelete