Just A Summary

Piers Cawley Practices Punditry

Falling out of love with a language

So, Giles Bowkett asked me on facebook “Why Perl?”. This is the long answer.

I’m a Perl hacker. I have been for around 16 years now. Around 5 years ago, prompted by the Pragmatic Programmer and Adam Turoff, I started looking at Ruby, and Ruby on Rails and sort of fell into maintaining Typo.

Why? I was getting hacked off with Perl.

I was coming to the end of my tenure/tether as Perl 6 Summarizer: watching a language that I still want to use before I die taking forever to get done gets wearing after a while, especially when you’re spending 8 hours a week summarizing the activities of a development community that, in parts, was verging on the toxic (it’s way better now).

I was also getting annoyed by small niggles in the way Perl 5 works. This was in the days before Moose. Stevan Little was just starting work on what became Class::MOP (as a prototype of Perl 6’s metaobject protocol) and way before the days of Devel::Declare.

Ruby seemed to be, as Matz has described it, “Perl, done right”. All the things that were pissing me off about Perl were so much easier in Ruby. I’ve joked, in a Ha Ha, only serious kind of way, that I left Perl for Ruby because I got fed up of unrolling @_, but there’s more to it than that. “Objects everywhere” fits my head. The language is dynamic. Ruby code had less boilerplate in it. Oh, and Ruby on Rails was looking very cool, even if David Heinemeier Hansson didn’t seem to have a clue about RESTful/Resourceful principles (he has rather more of a clue now). The community looked vibrant. What’s not to like?

I was a very happy Ruby programmer. It’s a great language. If you haven’t taken it out for a spin round the block, you should give it a try.

A Perl 5 rennaissance

While I was away on my failed attempt to become a maths teacher and then my Ruby sojourn, Perl 5 was waking up. If Perl 6 were declared a failure tomorrow by the people who are actually working on it (as opposed to the people who aren’t working on it, but bitch about it anyway – see some of chromatic’s more intemperate posts about those people), then it will still have had value for the way it’s inspired members of the Perl 5 community to nick the good bits and make them happen in Perl 5.

Stevan finished Class::MOP and it got used as the basis for Moose, which is essentially a layer of sensible defaults which sits on top of the insanely configurable and slightly more agnostic Class::MOP, which in turn sits on Perl’s weird reduced instruction set object orientation. Moose even got fast enough that it’s usable in polite company (it was always faster than Ruby), so people did. It grew an ecosystem.

Another, more recent development, is Devel::Declare. Devel::Declare is, in accordance with the long history of Perl, completely batshit insane. What it does is lets you trip the perl parser up and, while it’s standing there looking at the pretty birds flying around its head, you can run ahead and rewrite the code that it’s about to parse. Well, I say run, but what I mean is hobble ahead wearing narrow blinkers and mittens. You can accomplish amazing things in such circumstances, but it’s not fun. Devel::Declare enabled my current favourite module on CPAN: MooseX::Declare, which I’ve talked about here:

An introduction to MooseX::Declare from Piers Cawley on Vimeo.

MooseX::Declare lets me kill boilerplate. Instead of writing:

package Something;
use Moose;

has an_attribute => (is => ‘rw’);

sub a_method {
my($self, $with, $parameters)
= @_;


I can write:

use MooseX::Declare;
class Something {
has an_attribute => (is => ‘rw’);

method a_method($with, $parameters) { … }


which makes me happy. This is being done by a module which is written in Perl. It relies on a couple of modules that are implemented in C, but the bulk of the work is done in Perl itself.

So, that’s addressed one of the annoyances that led me to Ruby. What about ‘objects everwhere’. I got used writing things like:

5.times { |each| … }

Surely I’m not going to able to write:

5→times(sub {…})

in perl?


use Moose::Autobox;
sub Moose::Autobox::SCALAR::times {
my($count, $block) = @_;

5→times(sub {$_→say});

Bingo! I’d like to be able to write 5->times { $_->say } but can’t quite manage it. Give PerlX::MethodCallWithBlock a little more time though…

So, while I was away, most of the issues I had with Perl, issues that had driven me into the arms of Ruby, had been addressed.

It’s not about the bike

The new Perl tech is great, but all it does is removes barriers. I wasn’t attached to the Perl language by some huge bungee cord which was crushing me against these barriers while I sojourned in Ruby land, all the while pining for Perl. I was loving Ruby. It’s a great language.

What I am attached to is the group of friends I’ve made in the Perl community over the years. Many of whom I’ve never actually met face to face.

I felt like such a curmudgeonly old fart in the Ruby community (more specifically, the Rails community). Everything’s shiny and new and awesome. And, I suppose when you’re coming to the language from something like PHP, it is shiny and new and awesome. But it gets wearing after a while. And the arrogance? My dear! The arrogance! Admittedly, some people have a lot to be arrogant about – I still cheer DHH’s “Fuck you!” slide, but others… not so much. The kind of “Look! Ruby is uniquely suited to writing DSLs!” bullshit1 that sends chromatic off in fits of apoplexy annoyed me too, especially when I was looking at the kind of examples they were presenting as exemplary and remembering Perl from 5 years before that did the same thing but with cleaner language-like interfaces.

Coming back to Perl may well be a straightforward retreat to competence. I may be rationalizing like mad. But right now, it feels like I left Ruby because the ruby community, in the West at least, isn’t a fun place for me to be. The sexism is just the icing on that particular cake.

1 Here’s my response to Rspec:

testclass exercises Something {
test that we can create an object {
isa_ok $test→subject→new, ‘Something’;

Note the lack of perlish furniture in the test that we can create an object part. No need to quote the strings, no meaningless dos scattered about the place, no :symbols appearing at random. Okay, so I have to quote 'Something' in the implementation block, but the implementation block is unadulterated Perl. I don’t claim that only Perl can do this. I do claim that, right now at least, Ruby can’t.

Published on Wed, 10 Mar 2010 02:03:00 GMT by Piers Cawley under , , . Tags , ,

If you liked this article you can add me to Twitter
  • Gravatar

    By Ollivier Robert Wed, 10 Mar 2010 04:12:37 GMT

    As a former Perl hacker for more than 10 years and now Rubyist myself (but before Rails!), I can agree with most of what you said (including the arrogance!) but for myself, what you mention about Perl that makes you go back to it, I’ll say that Ruby stays a much cleaner language. Whatever devilishly clever trick and syntaxic sugar you apply to Perl5, it stays a non pure-OO language with too much syntax. Cheers and thanks for the article!

  • Gravatar

    By Piers Cawley Wed, 10 Mar 2010 05:30:40 GMT

    I like syntax, and I like being able to switch between functional and OO style in the same code. I prefer Perl to Ruby and Python. I prefer Haskell to Scheme and Common Lisp.

    But I like Smalltalk which has even less syntax than Scheme. Consistency is overrated.

  • Gravatar

    By perl Wed, 10 Mar 2010 09:09:55 GMT

    In the first source,

    sub a_method {
    my(@self, $with, $parameters)
    = @_;


    I think @self is typo. it seems that it should be $self.

  • Gravatar

    By Piers Cawley Wed, 10 Mar 2010 09:11:58 GMT

    Good spot, thank you.

  • Gravatar

    By Jason Dusek Wed, 10 Mar 2010 12:10:22 GMT

    Although I’ve never been a fan of Perl, it would be cool if in the next
    couple of years the Perl community was like “Hey, we figured out how to implement all that stuff in Perl, thanks for the ideas…”

  • Gravatar

    By Andreas Schipplock Wed, 10 Mar 2010 12:41:41 GMT

    Perl had and has bad marketing and people think it’s a language for “hackers” and/or system administrators who are in need of a quick script to accomplish some cumbersome task they don’t want to do by themselves.

    This resulted to a lot of dirty code but people need to know that perl code can be as beautiful as any other “beautiful” language.

    Your blog helped by suggesting to use Moose which is a brilliant piece of “work”.

    And OMG, I didn’t know MooseX::Declare! This is even cleaner! :) Great.

    Andreas Schipplock.

  • Gravatar

    By draegtun Wed, 10 Mar 2010 13:14:14 GMT

    re: PerlX::MethodCallWithBlock

    Even better if method blocks were added directly to Perl!

    See: http://d.hatena.ne.jp/gfx/20091204/1259908987

    Perhaps in 5.14?


  • Gravatar

    By chromatic Wed, 10 Mar 2010 13:34:33 GMT

    The irony of a Ruby programmer complaining about “too much syntax” in the light of your Perl 5 test code will amuse me all day. Has he read Rake code sometime?

    Syntax isn’t the problem. The wrong amount of consistency is.

  • Gravatar

    By mark@hotmail.com Wed, 10 Mar 2010 17:27:01 GMT

    “Has he read Rake code sometime?”

    What’s wrong with rake code?

    What’s wrong with ruby code?

    All I can do in perl I can do with ruby, but shorter, more succint and more elegant. This has nothing to do with arrogance, because I don’t see much arrogance at all in the RUBY community. And Rails community does NOT equal ruby communit.

    Ruby as a language is better than perl.

    You will see it when you look which language the YOUNG folks of today pick up. :)

    I swear perl is low on the list among the scripting languages. Probably python leads, then either php or ruby (probably still php although it seems to decline slowly. Never underestimate the www, or “things that just work” though.)

  • Gravatar

    By Piers Cawley Wed, 10 Mar 2010 18:36:03 GMT

    Okay, I’m stepping in on this one now. Take it outside you two. If chromatic feels the need to answer Mark in more detail then we know where to find his blog. And if Mark continues to make unsupported statements like “Ruby as a language is better than perl” then there will definitely be pointing and laughter.

  • Gravatar

    By chromatic Thu, 11 Mar 2010 00:13:08 GMT

    Piers, your final paragraph is sufficient reference to the Ruby scaffolding necessary to make Rake and RSpec “just like plain English”. I need not write more.

  • Gravatar

    By Daniel Wed, 17 Mar 2010 03:00:49 GMT

    Piers, you are blaming the Ruby community for arrogance, yet my experience with the parts of the Perl community I’ve seen is much worse. Wherever anyone asks a question, there’s not only several people claiming that the question is wrong(!) – as soon as anyone tries to actually answer the question, a new bunch of Perl-masters claim in to tell that the answer is wrong.

    Your pieces of “We already did that” and “We know better” in regards to DSL and the enthusiasm in the Ruby community is also very close to that attitude. (What if that same very enthusiasm is what makes you write an answer to Rspec instead of coming up with it?)

    And then chromatic shows up …

    Perl is for hackers, since Perl hackers only respect Perl hackers. And @_\$→%; those enthusiasts.

    The nice part of your post was what you wrote about Moose. I’ll have to look in to this, maybe it can help me stand Perl a little longer.

  • Gravatar

    By Piers Cawley Thu, 18 Mar 2010 03:09:26 GMT

    Yeah, the ‘wrong question’ thing is a problem on IRC channels, but it’s not unique to #perl. I think the most poisonous example of that sort of thing that I’ve seen was when Erik Naggum was in his pomp on comp.lang.lisp. But I’ve seen it on #rails and #ruby as well. It seems to be global unless communities work very hard to suppress it.

    Answering RSpec rather than inventing it? Well, what else am I going to do? I think the RSpec idea of naming tests with sentences is a bloody good idea, so of course I’m going to try and bring it back to Perl with me. Because the tools I have in Perl let me add a new special form that means I don’t need to have so much explicitly Perlish apparatus mixed in with my test declaration language, then of course I’m going to use it. It is, after all, one of the bits of tech that brought me back to the language.

    I don’t claim that the Perl community is made up of angels (but chromatic is far nicer in person than you might believe from his blog posts and comments here. Modern Perl is shaping up to be a cracking introduction to writing Perl in good style for beginners and experienced programmers).

    Your claim that Perl programmers don’t respect anybody who isn’t also a Perl programmer seems a bit rich. I’m not as au fait with the current state of CPAN, but let me point you at modules like Plack which brings Rack style to Perl, Dancer which will ring huge bells if you’ve ever looked at Sinatra, Moose is built on Class::MOP, which owes debts to (at least) the Common Lisp Object System and Smalltalk. MooseX::Declare pinches syntax from pretty much every curly brace language that isn’t Perl. MooseX::Declare is also evidence of the fact that some Perl programmers look at their language with a critical eye and fix the bits that suck.

  • Gravatar

    By Daniel Fri, 19 Mar 2010 02:26:44 GMT

    That was a very polite, and thoughtful, answer to my rather harsh comment. I guess that shows that I have a lot to learn, both regarding the Perl community and on writing better comments. (The chocie of language have effect on the result here too, I always come through as either stupid or rude when I try to write English.)

    What I said about answering to RSpec was in no way meant as a criticism of your code – I agree that it reads better than RSpec. I think that the “everything’s shiny and new and awesome”-attitude, or enthusiasm as I’d rather put it, while sometimes being a little short sighted also is a great creativity booster. Things have happened in the Ruby community, and while a lot of it might have been both possible and profed in other languages long before, I do believe that the ability to say “Yes!” and “Cool!” instead of “Nay, that’s old” has resulted in a lot of fantastics implementation, if not always invention.

  • Gravatar

    By Programmer Tue, 30 Mar 2010 04:29:23 GMT

    So the reason you came back to Perl was (1) you feel “old” and (2) the difference between how you write something in Perl is no longer far enough from what you have to write in Ruby to annoy you?

    That seems to amount to you are just there because you like the language, not because the language actually has any reason to use it. I would agree with this.

  • Gravatar

    By Piers Cawley Tue, 30 Mar 2010 04:51:22 GMT

    Wow Programmer, aren’t you the charmer?

  • Gravatar

    By Benjamin Tue, 30 Mar 2010 08:25:24 GMT

    Having been a big fan of your summaries back in the day, I look forward to reading more of these types of articles from you! Personally, I look forward to the day when parrot makes it possible to write in pyruberl.

  • Gravatar

    By Programmer Wed, 31 Mar 2010 07:08:23 GMT

    Why do you take it offensive when I point out that your reasons were purely personal. You offered no rational reason what-so-ever to actually use Perl. This falls within my expectations, but I don’t get what would be offensive about pointing it out. You can use anything you like for any reason you like (or none at all).

  • Gravatar

    By FiFo Tue, 06 Apr 2010 16:28:17 GMT

    Hehe, I’m waiting for the day when OO (and functional programming) isn’t modern anymore. OOP is just there to help you designing good and logically structured code. Smalltalk and Ruby are at least doing it the right way (Moose too, but it’s not really a language), but in these times it seems to be used to make people program, which shouldn’t program. It’s also for people, who don’t want to understand computers and that programming languages are languages. This isn’t an offense, but one shouldn’t forget that everything somehow comes down to assembly, which isn’t OO.

    Yes, OO is nice, but I always liked Perl as a language that wants is proud to be a (natural) language-like interface. Today I watched the presentation of Sinatra (a ruby web framework). It is a bit funny, that ruby guys have enough of creating classes and objects for everything. It’s also funny to see how they discover that building things modular instead of monolithic is a great thing. It’s very funny to see how they use a style of programming which gets away from OOP and at the same time talk about breaking things down. Wasn’t OOP always a way to make things more modular?

    To me this looks like a big irony.
    Don’t get me wrong. IMO OOP is a great thing. I like Smalltalk and Ruby, but it seems that people don’t know the original philophies anymore. That’s really sad, because paradigms that have been ‘discovered’ decades ago have to be rediscovered and the same errors are being made over and over again. Think about the Unix philosophy, which says portability and easy formats and interfaces are important, aswell as modularity. “Do one thing and do it good” Oh and what I really dislike is that there are a lot of people which seem to think complexity is a good thing.

    The Perl and Ruby guys are okay about this stuff, but have a look at the Java, C++ or C# people. Their understanding of OOP is… non-existent(?) in most cases. It would be really sad, if the Perl (and Ruby) people simply program OOP and say it’s simply better, without knowing when and why.
    “Let’s write a Hello World Program. We Define a ‘Talker’ class, a ‘Sentence’ class, which is a subclass to String, …”

    Sinatra and some tools around it are great example that you have to be an OO-extremis all the time.

  • Gravatar

    By Michael Nielsen Wed, 07 Apr 2010 01:53:31 GMT

    Ah, Piers, you have been missed. Now I need to go see if MooseX::Declare will work in our production environment…

  • Gravatar

    By Stomme poes Tue, 13 Apr 2010 14:53:47 GMT

    Wow, what a nice story there. I heard you sing I think in Copenhagen so I remember you. I like reading thoughtful explanations of people who’ve moved from one language to another, enough to see from both sides. Cheers (you going to Pisa?)

  • Gravatar

    By Andres N. Kievsky Sun, 18 Apr 2010 08:30:41 GMT

    “What I am attached to is the group of friends I’ve made in the Perl community over the years. Many of whom I’ve never actually met face to face.”

    Good for you. Some of us, however, care only about the language and use it to work, and don’t have (or particularly want) perl-community friends. Moose is not enough to clean up Perl, even though I will be using it for work when I have to, things could be faster and better – and pretty much nobody is looking into that.
    I suggest you revisit C or C++ and compare its speed with Perl. Why settle for something so slow and buggy? I’m writing code in C++/Qt and Obj-C that takes about the same amount of time to work out as perl, but it’s enormously faster.

  • Gravatar

    By CBT Thu, 22 Apr 2010 13:45:25 GMT

    Andres, you seem to be confused. Piers was explaining why he chose to come back to Perl. Why did you take that as an invitation to make a superficial argument towards a completely different kind of programming language?

    People who are used to dynamic languages (Perl, Python, Ruby) are usually not going to be convinced by “it’s faster”. It’s simply not relevant.

  • Gravatar

    By Ian Tue, 27 Apr 2010 11:56:24 GMT

    I’m a youngster who recently decided to learn Perl as his first language, but it took a lot of research to get past the almost ubiquitous Perl-bashing that you find when googling for information (90% of which seems to come from Python’s direction..).
    So I’m very pleased that the Perl community has recognized the central importance of marketing as well as making technical progress with the language itself; it’s currently very psychologically difficult to choose Perl over the shinier, cooler languages. And Perl does need new people to learn the language, and learn it well.
    But in the end, I’m glad I took the time to investigate thoroughly and try out several languages before settling on one. I’m a very happy user of Perl 5.12: the community is great, the docs are great, CPAN is awesome, and I can develop a good coding style of my own, without the need for a straight-jacket. Thanks guys!

Comment Falling out of love with a language

Trackbacks are disabled

Powered by Publify – Thème Frédéric de Villamil | Photo Glenn