Perl 6 Hangman

Ovid on 2008-12-29T10:02:29

Aside from going north and spending time with family in Stoke-On-Trent, I also spent time working with Perl 6. I started by writing a "hangman" program in Perl 5. At first I thought it would be too simple, but in porting it to Perl 6 it turned out to have just the right mix of a number of important features. I needed I/O to read a wordlist, regexes to match letters and a simple class to encapsulate everything. I also submitted three bug reports and a medium size doc path. All things considered, not too bad given that I spent most of my time with family.

Speaking of bug reports, this was a tough one to debug in r34446:

class Foo {
    has @something is rw;

    method doit {
        @something = <1 2 3>;
        say self!something;
    }

    my method something () {
        return "Hello, World!";
    }
}
my Foo $foo .= new;
$foo.doit;

That prints '123'. Comment out the @something lines and it prints "Hello, World!" as expected.

Despite minor hitches, I was very pleased with how far Perl 6 is coming along. When I get something working, I'll post it.