Install Raku (Perl 6) in Ubuntu along with Perl 5.26
Asked Answered
E

2

9

I am eager to learn Raku(Perl 6) and its syntax.

I already have Perl 5 installed in my Ubuntu machine.

vinod@ubuntu-s-1vcpu-1gb-nyc1-01:~$ perl -v

This is perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-linux-gnu-thread-multi
(with 67 registered patches, see perl -V for more detail)

Copyright 1987-2017, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

I want to install Raku in the same Ubuntu system. I have couple of questions:

  1. How can I install Raku ?
  2. If I install Raku, will Perl 5.26 will be get wipedout/updated? I want Perl 5.26 in my system because couple of scripts are running in Perl 5.
  3. Can I have 2 versions of Perl in single server ?
  4. Once if I install Raku, how can I run the Raku/Perl 5 code in Ubuntu server? Is it like I should mention use Perl 5.26; at the beginning? By default which version of Perl it will take?
  5. How can I run Raku code?
Escadrille answered 22/10, 2019 at 7:0 Comment(3)
Re "Can I have 2 versions of Perl in single server ?", Yes, but Perl 6 / Raku is not a version of Perl; It's a brand new language.Christianson
@Christianson : Thank you. Shall I have 2 versions of Perl i.e., 5.24 & 5.26 in same server ?Escadrille
That can be done. I have a dozen versions. You can install Perl into any directory. You can use perlbrew to install itChristianson
H
12
$ sudo apt-get install rakudo 
[ ... stuff happens ... ]
$ perl6 -v
This is Rakudo version 2018.03 built on MoarVM version 2018.03
implementing Perl 6.c.
$ perl -v

This is perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-linux-gnu-thread-multi
(with 67 registered patches, see perl -V for more detail)

The Raku compiler is in a package called rakudo. That package includes a program called perl6 which is the actual Raku compiler. The Perl compiler and the Raku compiler are two completely separate programs, so there is no problem having them both installed and running code using either of them. They are as separate as Perl and PHP.

Update: In a (now, bizarrely, deleted) comment, you asked

What was the way to open a vi editor and write a code in that

You do it in exactly the same way as you would do it for any programming language where the code is compiled or interpreted on each execution - Perl, Python, Ruby, bash, they all work the same way.

You can write a text file containing Raku code and run it with perl6 your_file_name.

Or you can put the correct shebang line (which is #!/usr/bin/perl6) at the top of the file and make the file executable with chmod +x your_file_name.

Hieronymus answered 22/10, 2019 at 7:10 Comment(1)
Thank you @Dave. I deleted the comment because I found an answer. Sorry for that.Escadrille
D
9

There is a community maintained Repository of the most recent build of Rakudo available here : https://nxadm.github.io/rakudo-pkg/

This is generally updated a few days after each official release and is currently on 2019.07.1

Dihybrid answered 22/10, 2019 at 8:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.