Jun 26

I finally got to my first YAPC this year – coincidences and conflicts kept me away in previous years. So excuse me for getting all dewy eyed, but it was a great experience! Haven’t felt that close to a development community since the early Oreilly Perl conferences. I feel all energized about Perl again and it makes me want to host a winter workshop in the bay area someday.

Here are some cool things I learned about:

  • distroprefs – A way to improve the automatability of CPAN installs; namely, dealing with those pesky distributions that insist on asking you questions. We spent a bunch of time at Hearst writing expect scripts to deal with these so that we could automatically install our large CPAN base on different servers. Wish I’d known about distroprefs!
  • Dist::Zilla – I’ve always been vaguely bothered by the amount of boilerplate in my CPAN distributions (copyright, author, version, etc.) but Dist::Zilla has finally provided the means and motivation to do something about it.
  • KiokuDB – Stevan Little’s talk on KiokuDB got me excited about leaving behind RDBMSs and the Impedence Mismatch on my next web project. Just store Moose objects! Of course people have been getting excited about object databases since the 80s, and there’s probably a reason that Oracle is still around. But allow me to enjoy my dream before it smashes into reality.
  • Memory persistence – As Steven Lembark gleefully hammered home, Perl never shrinks a variable. Once $foo has had a million bytes or @foo has a million entries, it’ll reserve that space forever, even if you empty it. Makes me want to look real close at any globals in persistent web environments.
  • CGI::Inspect – Brock Wilcox wins the award for most satisfying feature demo. Insert CGI::Inspect’s inspect() somewhere in a web template. When it runs, a dashboard launches in a new browser window, with a stack trace and the ability to inspect and change lexical state before the page resumes its render. Of course, other environments like JSP/Eclipse have had live debugging of web pages for years, but in Perl this still seems groundbreaking :) , and the possibilities for extending it are intriguing.

Here are the pages for the talks referenced above:

  • CPAN – A big enough lever to install the world
  • Dist::Zilla – Automating quality since 2008
  • KiokuDB – A Real World Introduction
  • Memory Manglement
  • Drop-In Web-Based REPL for CGI Applications
  • Jun 22

    I’m at CMU (my alma mater) for YAPC. I haven’t been back here since just after graduating in ’91. It’s a trip seeing it after nearly twenty years, with a mix of the completely familiar and unfamiliar.

    I wandered around campus for a while this morning. Each place jogs random memories from my head.

    • Learning Unix through Andrew
    • Working on the Oz interactive fiction project, still THE most fun software job I’ve ever had (if anyone wants to pay me to write text adventure games today, I’m there)
    • Trying desperately (and failing) to understand Hidden Markov Models for a summer research job on Kai-Fu Lee’s Sphinx project
    • Watching the “Dragon Lady” whip through dozens of programming languages in as many days, feeling like Neo in the Matrix (“I know Prolog!”)
    • Working on a LISP machine
    • Getting pathetically addicted to Moria
    • Working as an esteemed Ccon (“Computer consultant”), helping users log in and sorting printouts for minimum wage
    • Eating pizza on the floor of Wean hall at 3:30 AM during many all-night homework hacking sessions

    I feel old.

    Jun 01

    Last month I described custom code for wrapping certain methods of CHI driver subclasses, regardless of how far down the class hierarchy they were. I said I felt like I must be reinventing the wheel, and sure enough, Tim Bunce gently pointed me at Moose’s application of roles to instances.

    When I first heard about this feature I instinctively dismissed it because it sounded inefficient, as if each instance were individually marked with a list of roles. In fact, the implementation is perfectly efficient. When you apply a role to an instance, Moose simply applies the role to the instance’s class to create a new anonymous class, then reblesses the instance into it. This is cached, so the next time you apply the same role to the same kind of object, the cached class can be used.

    Now I’ve eliminated my custom code and have several roles working in CHI, each of which is activated by certain constructor parameters:

    • IsSizeAware – activated if is_size_aware or max_size is specified
    • HasSubcaches – activated if l1_cache or mirror_cache is specified
    • IsSubcache – activated for subcaches themselves

    Moving these features out into separate roles has cleaned up the main driver code considerably. It also speeds up the common case, since we don’t have to check for these things on each call.

    This does mean that CHI now depends irrevocably on Moose. For a short time we tried to compromise with Mouse as a way to minimize dependencies and application startup cost, but the role support just isn’t there, and even the authors of Mouse are now publicly discouraging its use. Given the intelligence and drive of those working on Moose, I feel confident that it will continue to get faster and make its way into ever more Perl installations.

    preload preload preload