Simple Game in Perl 6

Here's a little game which was a sub-game in the 1980's Commodore 64 game Legend of Blacksilver. It's a simple gambling game where you are dealt five cards in a row from a standard 52-card deck. The cards are then turned up one at a time. After each card is turned up, you have to guess whether the next card will be higher or lower in rank than the last one. Aces are high, and you lose all ties. If you guess all four right, you win.

[Update: There's a serious bug in this version, as pointed out by Brad in the comments, but I'm leaving it in the original so the comments make sense, since I'm writing these for learning purposes. A fixed version can be found at my GitLab account.]

Schedule for Swiss Perl Workshop 2015 ready

We are happy to announce the schedule for the Swiss Perl Workshop 2015.

We will have the Perl 6 Hackathon starting on Thursday August, 27th, Talks on Friday, August, 28th and Workshops and Talks on Saturday, 29th.

Since so many people are contributing to this years' program, it is difficult to highlight any events.

Feel free to listen to the talks you are interested in

  • War stories: programming in the field of medieval history‎‎
  • QA with Larry Wall‎
  • ‎Parallelism, Concurrency, and Asynchrony in Perl 6‎
  • ‎How to create CRUD database webapp in 40 minutes?‎
  • ‎Whatever, or How I Stopped Worrying and Fell in Love with Perl 6 Operators‎
  • ‎Normal Form Grapheme‎
  • ‎API Design‎
  • ‎Pearls from the contest‎
  • ‎OAuth2 and Mojolicious‎
  • ‎The Cool Subset of MAIN‎
  • Processing toki pona with Perl‎
  • ‎Introducing Replay
  • ‎Web::Machine - Simpl{e,y} HTTP‎
  • ‎Genetic Algorithms in Perl

or join the workshops

  • Kickstart your Perl 6 development
  • CallBackery Hands On‎
  • Perl 6 hands on
  • Hands-on code coverage tutorial

or come to meet us and do some socializing.

We have stil a place for you to join us, please register at perl-workshop.ch.

Perl5 to Java compiler is 1 month old, and we have a hackathon

We are having a hackathon at work, and Bosko, John and I have hacked together a working Perl script that executes in a Java environment (HBase).

Nóirín Plunkett

I'm sad to report that Nóirín Plunkett has passed away. Many in the Perl community knew them as a speaker and participant at YAPC::NA 2012 in Madison, Wisconsin, and YAPC::EU 2012 in Frankfurt, Germany, as well as other conferences including Open Source Bridge, OSCON, and ApacheConf.

Nóirín was passionate about open source, open documentation, and open community. In addition to their leadership within the Apache Software Foundation and the Ada Initiative, they were also a contributor to Perl v5.14. Most importantly, they were a friend and advocate to many in the open source and tech communities.

Getting Started

I started programming in Perl in about 1995, a few years before design started on Perl 6. Over the years, I've taken a look at Perl 6 from time to time, but never got hooked. Sometimes it appeared too hard to get a working system running -- assuming you could at all. Other times the language looked so foreign that I wasn't sure what the point was: if it didn't even look like Perl, then it might as well be a different language, so why not go learn a different language that was ready?

Well, that finally changed this summer. The impetus was an interview with Larry Wall wherein, with his unique style, he talked about the language (and a variety of other things) in ways that intrigued me and made me want to see what he'd created. Hearing that a real release of Perl 6 was no more than several months away, and that a working compiler could be installed with a few commands, hooked me the rest of the way.

Making Alien::Base more reliable

The Alien::Base (AB) team has done a number of things over the past year with AB to make the installing packages more reliable. For AB based Alien developers who have created their own Alien::Libfoo this is great because they get the benefit of more reliable installs when users upgrade their version of AB without having to release a new version of Alien::Libfoo. Though largely backward compatible with version 0.005 (or perhaps further), modern versions of AB have also been given a few interface enhancements that require changes in Alien::Libfoo in order to benefit. So if you are an AB based Alien developer, please consider a couple of simple changes that you can make to make your distribution more reliable.

Use %c instead of %pconfigure.

Masking Images with Imager

Sometimes you want to do something fancy with images in a completely automated way.  So for example, maybe you want to turn the image on the left into the image on the right:

image

It turns out this is a pretty simple process using Imager.

Step 1 - Create a blank image.

use Imager;
my $tile = Imager->new(xsize => 450, ysize => 450, channels => 4);

Step 2 - Create a mask. This is just a PNG file that is black where you want transparency, and white or transparent where you want things to show through. In my case I created this mask.

image

Step 3 - Use combine your mask with the image you want to mask.

my $mask = Imager->new(file => 'mask.png');
my $craftsman = Imager->new(file => ‘craftsman.png’);
$tile->compose(src => $craftsman, mask => $mask);

Step 4 - For extra flare, add a bevel. 

image

my $bevel = Imager->new(file => ‘bevel.png’);
$tile->compose(src => $bevel, opacity => 0.8);

Note: Technically, the bevel is being created in some extra software like Photoshop or Gimp, and we’re just applying it here.

Step 5 - Save the file.

$tile->write(file => ‘tile.png’);

image

As you can see, it’s pretty easy to do some pretty cool effects in Imager. Enjoy.

[From my blog.]

Perl::ToPerl6 released to CPAN

$ perlmogrify my-script.pl
$ more my-script.pl.pl6

Perl::ToPerl6 is now available on CPAN. This is the final name for the previously-mentioned Perl::Mogrify tool, with the goal of being able to transliterate (not translate, subtle distinction there) working Perl5 code into compilable Perl6.

Please ignore most of the documentation aside from the README file, as this application is heavily cribbed (read: mostly copied) from L (Thanks Jeffrey.) This tool is meant mostly for module authors, so please don't expect (yet!) a production-quality idiomatic Perl6 translation - We're still not sure what "idiomatic" Perl6 will look like.

Most of my effort has gone into changing operators because that's not easily done in search-and-replace (Keep in mind '.' -> '~', '=~' -> '~~', '->' -> '.') and whitespace is now significant in more places than you'd suspect based on a casual overview. Basically I'm trying to fix most of the simple stuff that would trip people up if they're porting modules by hand.

YAPC::EU - over 200 participants

YAPC::EU Granada has just passed 200 confirmed participants already passing two previous YAPC::EUs and there is still more than a month to go.

YAPC::NA in Salt Lake City gained more than 100 additional participants in the last 30 days, but they used a PR firm. I wonder if YAPC::EU will also get another 100 people. I try to log the numbers for future reference, but I am not sure how to help the organizers reaching more people.

The list of talks is certainly interesting and there are also the courses (and I hope my course will attract a number of people who would just want to learn AngularJS and as a side effect I can show them Perl as well.

Convert::Binary::C anyone?

I'm interested in getting Convert::Binary::C into a properly maintained state once again. It has a pod test that is failing (which should be an author or release test) and a regex deprecation warning in 5.22 that will likely render it uninstallable without patching in a future version of Perl. It's a really great module, and doesn't need a lot of changes just a few simple fixes. I've attempted to contact the author via rt, email and twitter. I'd be happy to adopt the module and resolve non-contentious bugs this module has collected. I believe I have a pretty good record on past adoptions, but I'd also be happy for someone else to do it, my goal is only to get a couple of pretty simple bug fixes into the module. If I don't hear from anyone I will try to adopt via the modules list.

edit: The original author has uploaded a new version with these (and a number of other) issues resolved!

A hackable text editor for the 21st Century

A hackable text editor for the 21st Century

[From my blog.]

Getting modern with logging via Log4perl

From last night's Sydney PM, my talk on Log4perl. In retrospect I should have named it "Logging: Not the fun kind with chainsaws and axes, but the boring kind with grep and less". Check it out:

Also worth sharing, from much discussion about the recent fad for "dashboards", is the perl Dancer based towncrier from the nice people at FastMail.fm. See their live usage of it here.

Has YAPC::NA 2016 been announced?

I don't seem to remember any blog post here or on TPF. Has the location, time or the organizers of YAPC::NA been announced?

Alien::Base: System Integrators vs. CPAN Authors

Last week I promised (or threatened depending on your outlook) to talk about Alien::Base in the context of system integration and distribution packagers.

Philosophy:

The philosophy for Alien::Base has always been that the system library should be used when it is available, and if not, the source code for that library can be downloaded and installed for you. My own Alien::FFI (isa Alien::Base) which provides libffi, and FFI::Platypus which uses it is a good example of the success of this approach as you can see from their respective testing matrices.

Alien::Base is of course trying to keep everyone happy all of the time, and everyone knows that is impossible. System vendors complain that Alien::Base has too many dependencies. Module authors fear that using the system library will make it too hard to support their XS modules since they could end up linking against almost anything. These perspectives frequently clash and it can be a challenge to maintain empathy for other parties when they do.

Grant idea - DBIx::Class re-documentation

Peter Rabbitson sent me this idea:

I can not think of anything qualifying as doesn't have to be a huge Perl project* However, I have an idea which unquestionably will benefit the Perl community immensely, yet has a remarkably low barrier to entry (mainly one thing - patience). I propose that someone applies for a grant in the role of DBIx::Class re-documentation project lead.

I have had inklings of "there got to be a better way to do things", but it wasn't until I read this meditation by BrowserUK that it dawned at me: Fixing up the better-than-most-but-still-terrible documentation of DBIC is a ~200 person-hour undertaking, which on top of that requires someones fresh eye. Given that DBIx::Class is a "staple-module" in the contemporary Perl ecosystem, I believe it is reasonable to expect for the TPF to "pick up the tab" if someone with the right qualifications steps up.

So what is wrong with DBIC's documentation anyway?

a perl5 to Java compiler - first benchmark

I've written a small performance test. And it is not bad!

First perl:

$ time perl misc/benchmark/benchmark_lexical.pl
done 64000000

real    0m3.964s
user    0m3.963s
sys     0m0.004s

And then Perl-in-Java:

$ touch Test.class ; rm Test.class ; perl perlito5.pl -Isrc5/lib -I. -It -Cjava misc/benchmark/benchmark_lexical.pl > Main.java ; javac Main.java ; time java Main
done 64000000

real    0m0.840s
user    0m0.584s
sys     0m0.302s

[EDIT] broken link

Web application development course before YAPC::EU

Just a reminder that I am running a 2-days long course before YAPC::EU in Granada, Spain.

In the course I am going to teach web application development using Perl Dancer and MongoDB in the back-end, and AngularJS in the front-end.

Actually, we are going to see a version of the front-end code using plain HTML with JQuery and Handlebars, and then another version using AngularJS.

There are still places left in the course.

Android Client for Lacuna Expanse

Android Client for Lacuna Expanse :

A member of The Lacuna Expanse community has built a new client for Android devices. Still in beta, but cool.

[From my blog.]

Tomorrow night, Sydney-PM

Please join us tomorrow night, (21st July) at 6pm for our monthly meeting.

Full details including location etc in this post

Fliers can be downloaded here and why not like us on Facebook

a perl5 to Java compiler - week 3

The compiler now has a small test suite. The main additions in the last 10 days were implementing global variables, better support for references, data structures, string interpolation, and a few new subroutines in the CORE namespace and operators.

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.