Wednesday, December 17, 2008

VIM syntax highlighting for Perl6

Just want to take note on what I did to enable syntax highlighting in VIM for Perl6. I followed this excellent procedure. Thanks Ovid.

Then if you are using NERD_commenter.vim plugin like I do. This is the best commenter for me by the way. You need to add another file type for perl6, as follows:

elseif a:filetype == "perl6"
    call s:MapDelimiters('#', '')

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:

C:\parrot-0.9.1>perl smoke_languages.pl

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:

C:\dev\perl6>perl6 hello.pl
"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...

C:\dev\perl6>perl6 hello.pl
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!

Tuesday, December 09, 2008

Free book: Higher Order Perl

This is one book I always wanted to have. Now, the author, Mark-Jason Dominus is giving it for free. Fantastic. Here's where you can download: http://hop.perl.plover.com/book/

Thank you very much, Mark-Jason.