• What sane person would want ASCII order?

    Jeff Atwood, whose blog Coding Horror is always worth reading, has a great post about natural sorting order vs. ASCIIbetical sorting order.

    Users will inevitably complain that their items aren't sorting properly, and file bugs on these "errors".... [W]e programmers produce a weary sigh, and try to keep any obvious eye-rolling in check as we patiently inform our users that this isn't an error. Items are sorting in proper order. Proper ASCII order, that is. As we're walking away, hopefully you won't hear us mutter under our breath what we're actually thinking-- "Stupid users! They don't even understand how sorting works!"

    Bravo for poking more holes in the tendency programmers have to think they know best.

  • Wanted: Dark Lord of Destruction

    Message Systems is looking for a Perl QA and stress-testing engineer, but they don't call it that. They're looking for a Dark Lord Of Destruction. I hope they accept applications for Dark Lady Of Destruction as well.

    You DID know about jobs.perl.org, didn't you? It's a free job listing service for Perl-related jobs, plus, you can help support the Perl Foundation by buying featured placement on the front page for a few hundred dollars.

  • Movable Type is now open source

    Six Apart announced today that Movable Type is now open source. They say that MTOS has every feature in Movable Type 4.0, which I think is a change. It'll be interesting to see if/how this changes Movable Type's share in the blogging community, since WordPress has always been able to wave the open source flag. I also might go and take a look at the source, which I've never examined because I knew there was no reason to.

  • 64-bit Macs may have CPAN build problems

    Mac OS X Leopard's Perl builds 32-bit Universal binaries by default, which may cause conflicts on 64-bit Macs with 64-bit apps like Apache 2.0. This article on Ars Technica gives the details, and the ARCHFLAGS fix.

  • Share your dotfiles and check out others

    dotfiles.org is a site that collects dotfiles for various shells and editors. If you've ever read someone else's .bashrc and said "Oh, THAT'S a cool trick", this is the site for you. If you haven't, now's the time to start. If you don't know what a dotfile is, or haven't modified the dotfile for your editor and shell, now is definitely the time to start.

    Popular dotfiles include:

    • .vimrc
    • .screenrc
    • .zshrc
    • .bashrc
    • .irbrc
    • .Xdefaults
    • .bash_profile
    • .xinitrc
    • .emacs
  • State of the Onion 2007: Let's go scripting

    It makes me sad to hear Perl programming called "scripting". "Stop saying script" is a common refrain of mine. I gave a lightning talk about this at OSCON 2007, and a few hours later, Larry Wall, Perl's creator, gave his State Of The Onion in the same room, and reviewed my lightning talk like so:

    _   /|
    'o.O'
    =(___)=
    U    ack --thpppt!
    

    Well, if you're gonna get dissed, might as well be by Larry, right? To read why he disagrees with me, see his just-published transcription of the State Of The Onion. I agree with his points, and yet, my core concerns about "scripting" being seen as not really programming still stand. How to combine the two?

  • Simple Apache/FastCGI/Catalyst configuration

    Leon Brocard posted this minimalist Apache configuration that covers Catalyst and FastCGI.

    I keep seeing more people not using mod_perl. Leon calls mod_perl "very bloated." Thoughts?

  • A couple of happy new Perl users

    Ask Bjørn Hansen pointed me at a posting called Perl -- An Awesome Programming Language. I have to agree although some of his assertions could use some gentle re-education, such as "the only drawback with Perl is that it usually is not compiled, but interpreted. One disadvantage because of this is that the user cannot just type the name of your program to run it." Nonetheless, we're glad to have Matt Mik added to our fold.

    My Google Alerts also turned up a user who was converted to Perl because of the ease with which he could use WWW::Mechanize as a web scraper. Does my heart good to know that he was reading Spidering Hacks, although it makes me feel a little old to have a book from 2003 talk about Mech.

  • How to: Document your code

    I have one rule to documenting code:

    1. Why, not what: Explain why the code is doing what it's doing, not what it is doing.

    Clearly this doesn't apply to code that is an API of some kind, where the code is the interface. Everywhere else, though, where the code is a mechanism to get the front-facing work done, explain the decisions that went into making the code do what it is.

    Some hypothetical examples:

    # Use port 3000 instead of 80 because that's what
    # Corporate is allowing us to use through the firewall.
    # Force this column to be a bigger font for Stan in Accounting.
    # Use Imager instead of Image::Magick because of
    # incompatibilities with frongdoodle mode in PNG images.
    # Can't use a JOIN here because MySQL 5.0's optmizer
    # makes a bad plan.  This is supposed to get fixed in 5.1.  See
    # http://wiki.mycompany/MySQL_optimization_problems for the details
    

    Note how all these examples explain something that may be out of the ordinary, or make the next reader (maybe even you) think "What the hell was this guy thinking?" A well-placed, well-written, well-thought-out comment will make the reader say "Aaaah, THAT'S why it's like that!"

  • It's Christmas in Perl-land

    Every year at this time brings the Perl Advent Calendar, 24 days of great new modules for you to know about. But what's this? This year the Perl Advent Calendar seems to have trouble starting up. They're looking for submissions for this year's calendar, and since it's already December 3rd, get on it!

    In the mean time, the Catalyst team have put out their own Catalyst Advent Calendar with 25 days of Catalyst tips. Catalyst is "the elegant MVC framework" and has quite a bit of traction. Their website is certainly better looking than your average Perl project website.

    Finally, PHP guru and all-around swell guy Chris Shiflett is running his own advent calendar focusing on a different member of the PHP community, and tips and tricks from that person. It's really nicely done. I'm also coveting the formatting for his code blocks. I'll just add "steal code block CSS from Shiflett's site" to the extremely long Perlbuzz.com to-do list.

  • BBC creates Perl On Rails

    The British Broadcasting Corporation has long used Perl, but:

    For applications that run internally we use Ruby on Rails. Because we enjoy using it, it's fast to develop with, straight forward to use and because we use it (i.e. to reduce knowledge transfer and training requirements) we decided to follow the same design patterns and coding conventions used in Rails when we built our MVC framework. Yes that's right we've built Perl on Rails.

    I know Curtis "Ovid" Poe is working for the BBC now, so here's hoping some of that Railsy goodness comes back to feed the community. The BBC already has 17 distributions on the CPAN.

  • Who's making bogus web requests?

    Yesterday I noticed in my Apache access log a lot of 404s that looked like this:

    aaa.xx.65.186 - - [25/Jul/2007:05:55:05 -0500] "GET http://www.some-advertising-site.com/banner/digits HTTP/1.1" 404 305 "http://some-different-website.com/" "legitimate-looking agent"

    Not only am I not hosting banner ads, the GET request is invalid. It should be GET /banner/digits..., without the scheme and hostname part of it. I wondered how many I had of these, and how many hits I was getting. A Perl one-liner to the rescue!

    perl -MData::Dumper -nae'++$n{$F[0]} if /GET http/; 
    END{print Dumper%n}' access.log
    $VAR1 = {
    'aaa.xx.65.186' => 132, # Real IPs obscured
    'bb.yyy.7.60' => 48,
    'ccc.zzz.46.147' => 111,
    'dd.qq.71.82' => 33
    };
    

    So it looked like I was getting hit by a couple of 0wnz0red boxes with some sort of virus on them. I added them to my iptables DROP list and was done with it.

  • A roadmap for Perl 6 and Parrot

    Patrick Michaud, bless him, has produced for Perl 6 and Parrot what it's needed for a long time: A roadmap for future development. (Note that the link points to the Subversion repository for Parrot, and may be moved over time.) It's well worth reading, especially if you're wondering what Parrot and Perl 6 are all about as far as implementation and development.

    Key tech points for those not into reading so much:

    • Pugs is the Perl 6 on Haskell implementation being used to work out the language itself
    • The Pugs repository will be the home of the "official Perl 6 test suite" for now, and will be reorganized to make sure it reflects the current Perl 6 spec.
    • The Perl 6 compiler has four components
      1. the parsing grammar
      2. some parsing support subroutines
      3. the AST (Abstract Syntax Tree) transformation
      4. runtime support
    • Parrot 0.5.0 has a new object model that eliminates many obstacles in compiler work
    • Larry has written a standard grammar for Perl 6, and the compiler will be reworked to align with it
    • NQP is "Not Quite Perl 6", a lightweight version of Perl 6 for bootstrapping the language. Most of the Perl 6 compiler will be written in NQP.

    Best of all, there's a big section called "How others can start hacking and contributing," with clear instructions for interested bystanders who want to jump in. Too often on projects I see current participants not realize that there may be a perceived barrier to entry for outsiders, and Patrick has done what he can to eliminate it.

    I love love love it. Thank you, Patrick. I hope this article helps pick up some interest from those who have not yet joined.

  • Mechanix, the new Perlbuzz section

    When I asked if you wanted more technical articles in Perlbuzz, there were two answers: a resounding "Yes!" and a less resounding but no less emphatic "No!" The path was clear: More technical articles for the people that want them, and sequestered in their own section for those that don't.

    We've now started the Mechanix column at http://perlbuzz.com/mechanix. The main Perlbuzz feed will continue to be mostly news & opinion about Perl in general, while articles relating to coding and programming specifically will wind up in Mechanix. I suspect that most of what winds up in Mechanix will be pointers to other technical articles, as with the current Mechanix articles, "80% Programmers" and Mark Dominus on undefined behavior. I also suspect that at some point that someone will complain that "This should have been in that section," but such is the nature of arrangements like these.

    Please also note that Mechanix is specifically vague.* I picked the name because it evokes a sort of code jockey feel to it, without tying down to anything in particular. For example, an article I have in my "to be written" folder is about my foray into the PHP 5.3 source code and the horrors that I've found.

    I hope you'll give Mechanix a try in your newsreader, and as always tell us what you think, either in comments on this entry, or emailing us at the "editors" mailbox for perlbuzz.com.

    * I bet that the Ruby guys pick up on my idea but call it "Four Horsemen".

  • 80% programmers

    Ben Collins-Susmann writes about the 80/20 split of programmers and how the 20% of programmers who are "alpha programmers" have to account for the 80% who are not, and how they use their tools.

    Although the post talks about Subversion and distributed VCSes, the lessons hold for those who use Perl, too. How many programmers have we worked with who don't know about CPAN, or are afraid to use code from CPAN? How about programmers who don't understand the internals workings of "standard" Perl objects (i.e. blessed hashes), who don't realize that a {} is an anonymous hash constructor, not a "class" or "object" constructor? Or who are afraid to use the map and grep constructs?

    On the flip side, you don't want to dumb down your code to the lowest common denominator. Although both Mark Dominus and chromatic have written about it recently, I like Randal Schwartz's phrasing best: "Sooner or later you're going to have to write in Perl." I'm dealing with PHP code at work where the original programmer did not use keyed lookups (PHP arrays are effectively ordered versions of Perl hashes) to check to see if a given string was in a list of special strings. I'm assuming that he was unaware of the ability to look up array elements by key, but I think it would be even worse if he specifically didn't use the feature out of fear, or worrying about future programmers not knowing what the code did.

    Assuming that you're a 20% programmer (and that you're reading a programming blog suggests that you are), how do you deal with 80% programmers? Any tricks for the rest of us?

    Addendum: Not five minutes after I posted this, I found this article "What if powerful languages and idioms only work for small teams?", with most of the value in the comments from readers.

  • Mark Dominus on undefined behavior

    MJD's recent blog post on undefined behavior takes you into some nitty-gritty of Perl internals and bizarre little behaviors you may not have seen before, plus side trips into Haskell and XML.

  • One step closer: Perl 5.10.0 RC2 is out

    Rafael has put out the second release candidate for Perl 5.10.0. Please download, build and test on your own specific machines and let's get Perl 5.10.0 out live.
  • Perl in the comics

    I think by now we've all seen the comic from xkcd.com that gives Perl its proper respect and place in the history of the universe.

    Some comics are a little less respectful, but I'll cut the guy some slack because he wrote a text adventure version of Pac-Man.

  • Perl gratitude, 2007

    Here in the US, it's Thanksgiving, a day of eating lots of food, watching football, and sometimes, just sometimes, expressing gratitude and giving thanks for those things that make life wonderful.

    Here are the things I'm grateful for in late 2007, in no particular order after the first.

    Google Code

    Google's project hosting service has been a godsend. It's changed the way I do open source projects. It has leapfrogged SourceForge for ease of maintenance, and the bug tracker trumps RT for CPAN that we've been using for so long. Add that to the integration with Google Groups which makes it trivial to create mailing lists, and it's at the tops of my list for 2007. I can't say enough good about it.

    The readers of Perlbuzz

    Eleven weeks ago, Skud and I started this little website called Perlbuzz as an alternative to the "more traditional outlets" for news in the Perl world. The response has been tremendous. We get 600 RSS readers every day, and have had over 10,000 unique visitors in that time. It makes me happy that our little venture is used and appreciated by the community.

    Test::Harness 3.0

    It's been over a year in the making, but the new version of the crucial Test::Harness 3.0 means more flexibility for module authors, and lots of UI improvements for people who just want to run prove and make test.

    Mark Dominus

    MJD is so much a fixture in Perl it's easy to forget that he's there. For 2007, though, never mind all the things he's done for Perl in the past, or the hours I've spent being enthralled in talks of his. His Universe Of Discourse blog is the single most intelligent blog out there, and sometimes it just happens to be about Perl.

    Andy Armstrong

    Was Andy Armstrong always around, or did I just not notice? His time and dedication spent on climbing on board with Ovid and Schwern and the rest of the Test::Harness 3.0 crew has been invaluable in getting it out. Plus, he's a really swell guy anyway.

    Dave Hoover

    When I finally despaired of the amount of time and frustration it took to organize content for Chicago.pm's Wheaton meetings, Dave Hoover stepped up and volunteered to take it over. I'm thankful, but not as much as I hope the other Chicago.pm folks are.

    Perl::Critic

    I'm all about having the machine keep an eye out for the stupid things we do, and the goodness of Perl::Critic is always impressive. You won't like everything Perl::Critic says about your code, but that's OK. It's an entire framework for enforcing good Perl coding practices.

    The Perl Community in general

    The Perl community is populated by some tremendous folks. Some names are more known than others, but these people help make daily Perl life better for me. In no particular order, I want to single out Pete Krawczyk, Kent Cowgill, Elliot Shank, Liz Cortell, Jason Crome, Yaakov Sloman, Michael Schwern, Andy Armstrong, Ricardo Signes, Julian Cash, Jim Thomason, chromatic, Chris Dolan, Adam Kennedy, Josh McAdams and of course Kirrily Robert. If you think you should be on this list, you're probably right, and I just forgot.

    My wife, Amy Lester

    Because even if she doesn't understand this part of my life, she at least understands its importance to me.


    I'd love to hear back from any readers about what they're thankful for. I'm thinking about having a regular "Love Letters to Perl" column where people write about what they love in Perl.

  • Perl trumps Ruby and Erlang in the Wide Finder Project

    Tim Bunce points me to this post about Perl being faster than Ruby in Tim Bray's Wide Finder code competition.

    The Wide Finder is at heart an Apache log analysis tool to show commonly hit pages, but for purposes of this comparison, it's analyzing 971MB. Bray explains:

    It's a classic example of the culture, born in Awk, perfected in Perl, of getting useful work done by combining regular expressions and hash tables. I want to figure out how to write an equivalent program that runs fast on modern CPUs with low clock rates but many cores; this is the Wide Finder project.

    All the talk about Erlang and parallelism makes me want to get back to working through my copy of Programming Erlang. Oh tuits, come to me!