Wednesday, December 17, 2008

Want to try Perl6? Here's how to get started in Windows.

02/19/2009: UPDATED for Parrot-0.9.1

I have my eyes on the next version of Perl. Perl6. I always wanted to somehow try it but never get the chance. Now that I'm preparing for a long holiday due to company shutdown, I want to play with it. I choose Rakudo Perl, which is an implementation of Perl6 targetting the Parrot virtual machine. As you already know, Perl6 is a set of specifications on this language. One of it's implementations is Rakudo.

Anyway, here's a procedure on how to install Perl6 on Windows XP. Rakudo Perl (Perl6 on Parrot), that is...
1. Download latest Windows build of Parrot and parrot-rakudo addon from here. Total of 2 executables.
2. Install and take all defaults.
3. Now do a smoke testing of the install:


If returns ok, then congratulations, your rakudo install is successful. If not, then proceed with the rest of this procedure.

4. Go to C:\parrot-0.9.1\bin, create a file and call it perl6.cmd. Have it contain the following:

@echo off
rem adjust the path below to suit your environment
set PARROT_ROOTDIR=c:\parrot-0.9.1
%PARROT_ROOTDIR%\bin\parrot.exe %PARROT_ROOTDIR%\lib\parrot\languages\rakudo\perl6.pbc %*

5. Rename C:\parrot-0.9.1\bin\perl6.exe to perl6.ex_. Just to prevent .exe from running.

Update 02/19/2009, I'm still using the workaround above because when I attempted to use the perl6.exe that came with the rakudo addon, I got this error message:

"load_bytecode" couldn't find file 'PCT.pbc'
current instr.: '' pc 405 (src\classes\Object.pir:20)
called from Sub 'parrot;Perl6;Compiler;main' pc -1 ((unknown file):-1)

Since this is a work in progress, I assume that these will all be fixed in the next release.

Now the moment of truth...

Hello World!

Hurray! Success. Now I can play with perl6. I plan on looking and writing some test that I can probably contribute back. Thank you so much to you all perl6 team.

By the way, just so you know, this is just a workaround. In the procedure that I found, perl6.exe can be built using a utility called pbc_to_exe, but it didn't work for me. So instead I followed this.

In the future, my wish is to have a one-click-installer for Windows of everything Rakudo. Meaning, an installer that will install Parrot, then perl6.exe or create perl6.cmd and set the environment variable. Which also can handle upgrading to latest build. That would make it easier for people to install and use it. Thanks.

Update 02/19/2009, in parrot-0.9.1, path environment variable is automatically set during install. Then about the issue above, I logged a new ticket in parrot regarding this.

Update 02/20/2009, speedy answer from the parrot team, ticket resolved. So for V.0.9.1, you don't need the workaround outlined above. Thanks a lot parrot guys!


fperrad said...

Currently, perl6.exe like all executable produced by pbc_to_exe,
works only in the Parrot build tree.

Anonymous said...

I think the instruction:


Should be: