Camelia

Getting started with Rakudo * (2013.01) on Windows

After a break of several months, I rebuild Rakudo on the server, a few days ago, and regenerated the Perl 6 Maven pages. This promptly broke the site. The fix was easy, and as expected the bug was mine.

Today I decided to try Rakudo on my Windows machine as well, but I went for the easy route and installed the pre-built msi file.

Note! This site is about Perl 6, the future version of Perl.
If you are looking for a solution for the current production version of Perl 5, please check out the Perl 5 tutorial.

Downloading Rakudo * for Windows

Rakudo Star is a package that includes Rakudo, the Perl 6 compiler, the Parrot Virtual Machine, documentation and a set of Perl 6 modules.

You can download the latest version of Rakudo * from their site. At the time of this writing the latest source code version of Rakudo * was 2013.02, but only the previous release had pre-compiled version, so I installed the MSI file of the 2013.01 version. (These are monthly releases.)

If you do the same, a few things you should know:

Notes from the installation

You can install by clicking on a few buttons, but as I recall it did not say it has finished. It just did.

It will install into c:\rakudo. Currently you don't have a choice.

It will add a menu item called Rakudo Perl 6. Clicking on the item will run Perl 6 and you'll find yourself inside the Perl 6 REPL. You can go ahead and type "hello".say just to make sure you are in the right place. Then you can go ahead and start playing with Perl 6 inside the REPL. You can close the REPL by typing exit.

PATH

If you write a Perl 6 program, for example creating the hello.pl file, open a command window (Start/Run/cmd) but unfortunately the installation did not put the perl6.exe in the PATH. You can configure the PATH environment variable in the Control Panel. This will take effect for all the cmd windows you launched after the setting. So you probably need to exit from all the cmd windows and open a new one.

You can also configure it for the specific cmd window you opened by typing:

set PATH=%PATH%;c:\rakudo\bin

After doing it manually, perl6 -v worked from the command line.

Typing perl6 will get you in the same REPL mentioned earlier.

You can run your scripts typing perl6 hello.pl

Documentation

Even after configuring PATH environment variable, you still cannot use the p6doc command. If you create a file called c:\rakudo\bin\p6doc.bat with the following content:

@%~dp0perl6.exe %~dp0p6doc %*

you will be able to type p6doc Str.

Perl 6 Modules

After a bit of searching I found that the c:\rakudo\lib\parrot\4.10.0\languages\perl6\lib is the location where the Perl 6 modules coming with Rakudo * are installed. I have not found any easy way to list them. Well, except of running dir.

You can type p6doc URI to read the documentation of the URI module. (It had some Unicode issues on my computer.)

Module installation

Just as with p6doc, you cannot use panda out-of-the-box either. You need to create a file called c:\rakudo\bin\panda.bat with the following content:

@%~dp0perl6.exe %~dp0panda %*

Then you can use panda to install additional modules.

On the first use panda will fetch the list of modules available for Perl 6 and will put it in c:\rakudo\lib\parrot\4.10.0\languages\perl6\site\panda\projects.json You can see the list by typing panda list.

If you'd like to use HTML::Template you can install it by typing panda install --notests HTML::Template.

We need to skip testing for now, as panda has a bug that requires the presence of the prove commnad from Perl 5, and even if it is there, panda will blow up in a nasty way if one of the tests fail. Unfortunately the tests of HTML::Template currently fail.

The Windows bat files

An explanation for the bat file, in case you are wondering:

  • The leading @ turns off echoing the command.
  • %~dp0 is the path to the directory where the bat file currently executed can be found, it already includes the trailing back-slash \
  • %* includes all the command line parameters

All set

So there were a few issues that need to be fixed, but in general the experience was not bad. (For example the bat files will be already included in the next release of Rakudo * and I think panda has been fixed since then.)

Once you have done this, you can start writing Perl 6 code.

Enjoy!


The Perl 6 Tricks and Treats newsletter has been around for a while. If you are interested to get special notification when there is new content on this site, it is the best way to keep track:
Email:
Full name:
This is a newsletter temporarily running on my personal site (szabgab.com) using Mailman, till I implement an alternative system in Perl 6.
Gabor Szabo
Written by Gabor Szabo

Published on 2013-03-15



Comments

In the comments, please wrap your code snippets within <pre> </pre> tags and use spaces for indentation.
comments powered by Disqus

Perl 6 Tricks and Treats newsletter

Register to the free newsletter now, and get updates and news.
Email:
Name: