You are here: Foswiki>PM Web>PugsFirstBloodEnglish (25 Aug 2007, SteffenSchwigon?)EditAttach
[See PugsFirstBlood for the german original version.]

My first Perl6/Pugs installation

Who wants to experiment with Perl6 takes Pugs these days. To compile Pugs isn't that hard. I did it on Debian Sarge. Here are the single steps:

Parrot

Parrot is the virtual machine for Perl6.

Svn checkout, compile, install

First try

Example program (fibonacci numbers) from Parrot docs:

  • fib.pasm

### Local Variables:
### mode: pasm
### End:
# fibonacci numbers
        print   "The first 20 fibonacci numbers are:\n"
        set     I1, 0
        set     I2, 20
        set     I3, 0
        set     I4, 1
REDO:   set     I5, I4
        add     I4, I3, I4
        set     I3, I5
        print   I3
        print   "\n"
        inc     I1
        lt      I1, I2, REDO
DONE:   end

(An Emacs-Mode for syntaxhighlighting of .pasm files is included with Parrot, look at the editors/ directory.)

  • Execute, 1st way, directly:
    • parrot fib.pasm
  • Execute, 2nd way, via bytecode:
    • parrot -o fib.pbc fib.pasm
    • parrot fib.pbc

Ok, works.

In case /usr/local/bin/parrot doesn't start (e.g. I had problems with version 0.4.3), a cp parrot /usr/local/bin/ might help.

Haskell

Pugs is implemented in Haskell. We need at least Haskell version 6.6.1.

Prepare

Haskell needs Haskell for bootstrapping. So get an old version of haskell first, e.g. with Debian do:

  • apt-get install ghc6

Download, compile, install

  • wget http://www.haskell.org/ghc/dist/6.6.1/ghc-6.6.1-src.tar.bz2
  • wget http://www.haskell.org/ghc/dist/6.6.1/ghc-6.6.1-src-extralibs.tar.bz2
  • tar xjf ghc-6.6.1-src.tar.bz2
  • tar xjf ghc-6.6.1-src-extralibs.tar.bz2
  • cd ghc-6.6.1
  • ./configure
  • make
  • make install                   # (as root)

Compilation needs reeeeaaaaaaly much time. My 2 GHz Celeron took about 5 hours for "make".

I don't know how to test haskell but Pugs will complain for sure if it doesn't work, so don't worry, and hurry up to the next chapter.

PUGS

Pugs (the "Perl Users Golfing System") is an implementation of the Perl6 specification in Haskell.

Svn checkout, compile, install

  • svn co http://svn.pugscode.org/pugs pugs
  • cd pugs
    • Only for nerds, set some advanced options:
      • apt-get install zlib1g-dev
      • apt-get install libperl-dev (I'm not sure whether really needed)
      • CPAN: install Bundle::Pugs::SmokeKit
      • CPAN: install Scriptalicious
      • CPAN: install Class::Multimethods::Pure
      • CPAN: install Data::Bind
      • CPAN: install version
      • export PUGS_EMBED="parrot"
      • export PARROT_PATH=${HOME}/path/to/src/parrot/
      • make clean
  • perl Makefile.PL
  • make
  • make test
    • some failures occured, I ignored them
  • make install            # as root

First try

  • pugs -e 'say "Hello, world.";'

Done.

-- SteffenSchwigon? - 22 May 2006

Topic revision: r7 - 25 Aug 2007 - 21:54:59 - SteffenSchwigon?
 
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback