Perl Love Archives

For CPAN Day: Show Off Your Web Framework!

While I know many of you have CPAN Day projects, some of you might still be searching. There is a very well known benchmark from TechEmpower which compares web frameworks. It gets plenty of press and generates much interest. Unfortunately, the Perl results look like this:


We all know the reputation that Perl has to the outside world, and sadly these results would tend to reinforce it. The person or persons who added these apps seems to have long since forgotten about them. At least the Mojolicious app was a port of one of the others and did not exemplify either the style or power of the framework. The others likely share those traits.

But all is not lost! TechEmpower has recently made it much easier to contribute, and I have fixed the deployment and toolchain problems. I have also updated the Mojolicious app. Would you like to improve the submission of your favorite framework or add your own? Read on!

MojoConf 2014 Recap

Last week I had the joy to attend the first (and certainly not the last) MojoConf in Oslo Norway. It was an incredible experience! First and foremost I want to thank the Oslo Perl Mongers, the organisation and execution of the conference was first rate! I also want to thank Jan Henning Thorsen (batman), who graciously offered to host me. We had such productive conversations over evening congacs, both Perl and otherwise.

I will admit now, that had wondered if the community was large enough to support an international conference. I am quite happy to say that my fears were unfounded. We had attendees from all over the world, including the USA, France, Greece, Israel, the UK, Germany and others I’m forgetting I’m sure.

Glen Hinkle (tempire) gave a professional training, which was sold-out! When companies (and even a few individuals) are willing to pay real money for training, it goes a long way to prove that Mojolicious is the world-class framework that we know it is.

I was also impressed (as Glen was) at the talk given by Richard Elberger (riche) in which he touts his company and the success it is having replacing an enterprise Java application with a Mojolicious one. He shared the success of the transition, detailing how everyone from the developers to the development managers to the stakeholders have been impressed at the ease and power of Mojolicious and Perl! That is so encouraging to hear! He even had all those enterprisey words that I try my best to ignore at my $dayjob, but what a feeling to hear them spoken about Mojolicious!

From a personal standpoint, it was so much fun to meet all these wonderful people and programmers who I have interacted with online for so long. I love that I can hear Sebastian’s laugh when he writes “haha” on IRC now! I can see him and Marcus and Salve and Vincent and Nils and Jan Henning and Nicolas and Glen and Alexander and Dotan and Richard and all the others, as they were, sitting around their laptops at the hackathon, rather than just names scrolling along a chat window.

So now the conference is over, but my excitement for Mojolicious is still peaking. I got so many ideas and so much motivation last week that I’m almost not sure where to put my attention first. I can’t wait for the next MojoConf, it can’t come soon enough!

See the presentation videos on the MojoConf YouTube channel!

Ephemeral methods, or what to call 'dispatch to a variable containing a subref'?

In my last post, I use a Perl dispatch pattern where you store a subroutine reference in a variable and then use that as the method to call on an object. Like so:

my $method = sub { ... };

Is there a name for this pattern? If not I propose to call the “method” an “ephemeral method”. Does this work for everyone?

Note that you really can’t call it a lexical method for several reasons.

The perils of & (and prototypes too!)

In a recent post, Chris K asks, why do I recommend using function() rather than &function() or &function. I happened to see it right before heading to bed, but I wanted to respond, so who knows if this is a good example or not. Anyway here goes, look at this code (seen below if you have javascript), it prints 6 lines, do you know what they will be?

A generator object for Perl 5

I have recently started a new job and it has forced me to learn more Python than I have ever had need to learn. I decided that I should take this as an opportunity to learn, and as Miyagawa-san has often done, steal when possible.

One thing that fascinated me is Python’s yield or generator pattern. In this pattern, you can make a function (or my case an object) which implements a lazy iterator returning a value (or possibly values (see below)) without leaving the while loop that generates them.

My Virtual YAPC::NA 2013

Last year I had the joy of experiencing my first YAPC, it was YAPC::NA in Madison, WI, which is just up the road from me in Chicago. Sadly this year YAPC::NA was much further away and I, having recently defended my Ph.D. thesis, could not afford the time nor cost to attend. While people (most notably Peter Rabbitson (aka riba, aka ribasushi)) offered to help me attend (he with the excess of his own funding drive), finding a job was of greater concern.

That said, I ended up having a great YAPC::NA. I have to extend massive thank the conference organizers for again providing streaming video of the conference talks. I was able to watch an incredible number of talks, learning many new things and seeing many Perlers who I have only known by name (several of whom were not at last year’s YAPC::NA). I even got two shout-outs from speakers!! (squee)

A complement to the video streams was the #yapc channel on IRC. We virtual attendees developed quite a rapport. Much as in real life I have a hard time leaving a group of friends, talking long beyond when I intended to leave. Sure enough, as those in the channel may attest, our conversations often lasted long after I said that I was leaving.

If there was a small silver lining to not attending live, being able to converse during a presentation was a new and interesting way to absorb the material (ie. “links here”, or “see my example there”, or “has anyone tried this with X”). I even once got a question passed to a live attendee to be asked of the speaker.

I was very saddened to not be able to attend this year, but the videos and #yapc made it almost feel like I was there. A few comments. I would have been happy to contribute a few dollars to defray some of the costs, perhaps a donation link or “virtual attendee” category might be considered; though I hope that videos continue to be free to watch, more for the newbie’s sake. Also when Barbie made his call to “submit talk reviews” I was sad that virtual attendees are not able to do so; he has heard my plea and has offered to consider this in the future.

As Brent Laabs so eloquently put it, “Truly, Perl’s community is it’s greatest strength.” Of course, I hope to be able to attend future YAPCs (not just NA) in person, but virtual attendance is an experience which helps to boost the community beyond just those who can attend. Congratulations to the YAPC::NA organizers, it was a great event, even for those not present!

Type::Tiny rescues Moo

I have just ranted about removing old bad code from the Perl core. Let me lighten the mood by talking about some good, new code.

I have loved Moose for some time now, but like others, I disliked how heavy it was. Then Moo came along and it was great … until I found myself not availing myself of the type system, because it was harder to get to than in Moose. I was skipping validation more and more.

A recent project came up and I really wanted to do it right, so I tried Toby Inkster’s new Type::Tiny and may I say, “hat’s off to you sir!” The combination of Moo and Type::Tiny brings that Moosey feeling back, while still being light and responsive and even fat-pack-able! Great work to all involved in both projects!

On the removal of some core modules

I’m sure most of the readers of this blog will have seen that both Module::Build and are up for removal from the Perl core. I thought I would toss my $0.03 (inflation) in on the matters.

Mojolicious 4.0 is coming soon!

As a newer member of the Mojolicious Core Development Team, I am more than usually excited for a Mojolicious release. This is because the next major release, version 4.0, is set to ship very soon! For those of you who don’t know, Mojolicious is a modern Perl web framework which is lightweight and easy to get started learning and using, while containing features that are cutting-edge. It’s asynchronous/non-blocking to the core, websockets work out of the box, comes with built-in DOM/JSON/UserAgent, etc etc.

Our fearless leader Sebastian Riedel (aka sri) will no doubt post a message with all the details when it ships. In the meantime, I want to share a little story of how community interaction, even at the StackOverflow level, can lead to innovation and enhancement of major projects like Mojolicious!

A Case for Tie::Array::CSV

What is the favorite module you have released to CPAN? For me, its not some shiny CMS or fancy scientific simulation. In fact, mine is probably horribly inefficient, maybe even a little evil, but I like this one best because it is clever.

Today I used my favorite of my modules in order to accomplish a difficult task, and in doing so I found a little bug, which I have just fixed. Which one is it? Let me introduce you to Tie::Array::CSV.

About Joel Berger

user-pic As I delve into the deeper Perl magic I like to share what I can.