Getting Started with Perl 6

For my work on the Perl6::Cookbook I wanted to check out how one can go and start using Perl 6 ? I have to admit that it was not clear to me so let me write down one of the approaches currently available.

You need an editor and one of the Perl 6 implementations.

Editor

The editor can be vim, emacs or any other text editor good for programming. I think both vim and emacs already have Perl 6 mode, I don't know about the others but I am not planning to write about any of these. I obviously will recommend Padre and its Padre::Plugin::Perl6

Perl 6 implementation

Perl 6 is planned to have multiple implementation like most of the other languages have but unlike Perl 5 which only has a single implementation. I am going to use Rakudo Perl running on Parrot as it is the one that currently shows the biggest potential.

Padre

Installing Padre can be easy or difficult depending on various things, most notably luck. Generally it should be enough to type install Padre in your CPAN shell but there might be some extra steps you need to make in order to get that work. The download page of Padre provides further details. Mandriva 2009 and Fedora 10 already have Padre packaged and while those are old version, it might be the best to use their package management and then upgrade. They might even provide backported versions of the latest Padre.

Padre, Parrot and Rakudo on Windows

If you are running Windows we distribute a version of Portable Strawberry Perl (beta 1) with all the necessary pieces already installed. It can be downloaded from the Padre web site

It is currently 60 Mb zipped and 300 MB unzipped, which is a lot, but it is worth a try.

Once you have downloaded and unzipped the file you should move it to c:\portable or some similar path (currently no spaces are allowed in the path). Assuming you put it in C:\portable you can then go to c:\portable\perl\bin\ and run the portablepadre.bat file. That should start Padre with an empty file. Type in


  use v6;

  say "Hello World";
  42.say;

and press F5. When offered to save the file chose a name with .p6 extension. It should run your code and provide the output in the lower output pane of Padre.

The Syntax highlighting is relatively slow, so it is tuned off by default but you can run in manually with the F6 key or in the Plugins/Perl6 menu.

Enjoy!

Update

Apparently the parrot and rakudo I distributed does not work as it has some hard code path requirements.

Tomorrow I'll try to build a new version which will include the missing files and will require you to install it in a specific location but will hopefully work then.

Published on 2009-01-12 by Gabor Szabo

In the comments, please wrap your code snippets within <pre> </pre> tags and use spaces for indentation.
blog comments powered by Disqus
Code::Maven
Python, JavaScript, Node.js, Ruby, and more.


Google Plus Twitter RSS feed