Day 1: Getting Rakudo

There are many different partial implementations of Perl 6; at the moment, the most complete is Rakudo. There are a number of different ways to get it up and running, but if you have any interest in tracking or helping with the development, the best approach is to download directly from the source repositories and and build your own copy.

To do so, you will need Subversion (svn), git, Perl 5.8 or newer, a C compiler, and a make utility. On standard Linux-like systems (including OS X), you can build it like this:

$ git clone git://github.com/rakudo/rakudo.git
$ cd rakudo
$ perl Configure.pl --gen-parrot
$ make
$ make test
$ make install

Subversion is needed to run –gen-parrot — it actually uses svn to get the appropriate version of parrot and then compile it.  You will need to use the appropriate make command for your system.  (It’s generally nmake with MS Visual C++, I believe.)

For current Rakudo, make install doesn’t install into your path, it merely preps the system so that you can run the perl6 executable (created in the rakudo directory) from any other directory on your system. Once you have it going, you can easily play around with Perl 6 by executing perl6 with no arguments, putting you into a REPL environment where you can type commands and see what they do. This can be incredibly handy for trying to figure out how Perl 6 works. For instance,

$ ./perl6
> say "Hello world!";
Hello world!
> say (10/7).WHAT
Rat()
> say [+] (1..999).grep( { $_ % 3 == 0 || $_ % 5 == 0 } );
233168

The lines starting with $ and > are what you type; the other lines are Rakudo’s response. The first example is a simple say statement. The second creates a rational number and asks WHAT its type is (Rat). The third takes the list of numbers from 1 to 999, filters out the ones not divisible by 3 or 5, sums them, and then says the result. (This is Project Euler Problem #1, thanks to draegtun for reminding me of it.) We’ll try to explain how these things work in a future post.

One last thing. If you have any difficulties getting Rakudo working, the #perl6 channel on irc.freenode.net is usually very helpful.

13 thoughts on “Day 1: Getting Rakudo

  1. Hi guys! Thanks for this first entry. Finally I got Rakudo installed and it was so simple! Looking forward to the following entrys.

  2. Hi. Sorry to be a buzz-kill, but what gets installed where? Am I putting unmanaged files on my system? Do I need admin/root authority? Does it just go into my home directory somewhere? I’m just an organizational fascist. I really like package management and like to keep unmanaged files contained or otherwise organized. If there’s a readme I can look at after the clone to figure out how to tweak that process, that’s good enough.

    Thanks
    Edd

  3. Ben: The P part of the REPL isn’t implemented yet :(

    Rakudo is having a major refactor in a branch right now, and hopes are that we can implement it in that branch rather soon, so I’ll expect it either for December or January release.

  4. During ‘make test’ I hit an error. Where should I go to follow up? I’m guessing irc? I’ll post the error below. Everything else came up ok.

    Thanks,
    Edd

    .
    .
    .
    t/01-sanity/07-simple-multisubs….ok
    t/01-sanity/07-split……………Null PMC access in i_bitwise_shl_int()
    in Main (file , line )
    t/01-sanity/07-split……………dubious
    Test returned status 1 (wstat 256, 0x100)
    t/01-sanity/07-substr…………..ok
    .
    .
    .
    Failed Test Stat Wstat Total Fail List of Failed
    ——————————————————————————-
    t/01-sanity/07-split.t 1 256 ?? ?? ??
    2 subtests skipped.
    Failed 1/29 test scripts. 0/232 subtests failed.
    Files=29, Tests=232, 51 wallclock secs (42.32 cusr + 3.79 csys = 46.11 CPU)
    Failed 1/29 test programs. 0/232 subtests failed.
    make: *** [coretest] Error 255

  5. Eddward: Yes, IRC is the best place to discuss this. In the meantime, what platform? You can also run

    make t/01-sanity/07-split.t

    which should run it again and detail the individual successes and failures.

  6. Maybe a little bit late — for those of you who run Fedora; thanks to Gerd, rakudo is in repository, just run “yum -y install rakudo” as root to install it!

Leave a reply to Eddward Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.