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:
I’ve only put my .vimrc up on my personal wiki, but I can see I’ll need to put it up here as well.
If you missed the opening of the Republican debate last week, you can watch a YouTube clip of broadcast TV of the eight candidates watching a YouTube clip of Chris Nandor singing his song about them.
If only he could have worked in a mention of Perl 5.10!
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:
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?
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?
Ask Bjørn Hansen pointed me at a posting called Perl — An Awesome Programming Language. I have to agree, of course, 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.
If you’re a programmer, you’re writing programs for your users. You are there performing a service for your users, not the other way around. Here’s an excellent way to insult your users by letting them know that they are not worth one minute of your time:
print "Now showing $n item(s)";
The parenthetical (s) as a shorthand for saying “This could be singular or plural and still let me off the hook” is a throwback to times before computers, when people worked on paper forms. It is now unacceptable.
my $s = ($n == 1) ? '' : 's';
print "Now showing $n item$s";
Is it a pain to write that out? Hardly. Maybe a twinge of discomfort at worst. However, to take the shortcut of (s) says that you are so lazy as a programmer that you don’t care about the user, and it says that every single time the user sees that message.
I have one rule to documenting code:
- 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!”
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.
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.