Day 1: Getting Rakudo

by

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.

About these ads

13 Responses to “Day 1: Getting Rakudo”

  1. bened Says:

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

  2. Eddward Says:

    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. Moritz Says:

    Hi Edward,

    when you run ‘perl Configure –gen-parrot’, parrot is installed into the parrot_install directory below your rakudo directory. Running ‘make install’ installs into the same dir, so the binary ends up in parrot_install/bin/perl6. No root privs required.

    See also: http://rakudo.org/how-to-get-rakudo and http://github.com/rakudo/rakudo/blob/master/README

  4. Ben Atkin Says:

    How do you make the REPL print the evaluated expression by default, so you don’t need to type “say”?

  5. Moritz Says:

    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.

  6. Eddward Says:

    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

  7. colomon Says:

    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.

  8. The Perl 6 Advent Calendar | JetLib News Says:

    […] featuring one cool Perl 6 feature every day until Christmas. Topics currently covered include how to get and build Rakudo (the most actively developed and progressed implementation of Perl 6) and the new Metaoperators. […]

  9. Perl 6 Advent Calendar на русском | Ky6uk's Blog Says:

    […] декабря в рамках цикла статей было рассказано обустановке Rakudo, использованию циклов, операторах […]

  10. День 1: Получаем Rakudo | Ky6uk's Blog Says:

    […] я и планировал, выкладываю перевод первой статьи цикла Perl 6 Advent Calendar. Напоминаю, что перевод […]

  11. Lubomir Rintel Says:

    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!

  12. Fabian Wesson Says:

    I just wanted you to know this is now my favorite web site. You guys rock!

  13. 扶凯 » [Perl6]取得 Rakudo 开始 Perl6 Says:

    […] By colomon: http://perl6advent.wordpress.com/2009/12/01/day-1-getting-rakudo/ […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

Join 44 other followers

%d bloggers like this: