And behold, there came the time of Refactored Overloaded Objects

| | Comments (0) | TrackBacks (2)

If you're a Perl coder who hasn't been keeping a close eye on CPAN then you may have missed the latest chunk of code making quite a stir, namely Brian "Ingy" Ingerson's marvellous IO::All. And it is marvellous: if Perl is the Swiss Army Chainsaw then this is the new light saber attachment - can't do anything you couldn't do previously but it slices through most IO jobs in one or two lines, from file slurping (one line, obviously) to creating a forking server (er, two lines). This Perl.com piece would be a great introduction if another burst of coding from Ingy hadn't rendered it half-obsolete a mere three days later. But, dammit, that's what we like to see!

IO::All's design could be described, for want of a decent OO education, as "overload one class with a billion different uses" and in this case it seems to work well. The vast majority of the code revolves around grabbing code from other modules and wrapping them up in several big contextualising switches so that this single class is almost all you need for your to-ing and fro-ing with the outside filesystem. In other words, it's all about the interface. It feels very Perlish in its mixture of minimal code and DWIMness so it's not surprising that many in the Perl community have jumped on it gleefully. This "The Best $DOMAIN Functions In The World... Ever!" approach to module-building is infectious, and Yung-Chung Lin's Var module is probably going to be the first of many imitators. If you fancy having a go yourself, then Ingy's Spiffy base class is what you want to start with, but please use your enhanced exporting powers wisely: packing a single class with tons of functions (a la Python) is fine and pretty, but doing that to the default namespace (a la PHP) is just inconsiderate.

2 TrackBacks

Listed below are links to blogs that reference this entry: And behold, there came the time of Refactored Overloaded Objects.

TrackBack URL for this entry: http://cheerleader.yoz.com/mt/mt-tb.cgi/127

» Joe Black from Jefferson Pearson

A swivel was in print; such as was most decorous. Read More

» Jeffree Star Ringtones from Jeffree Star Ringtones

STENER. OFFICE OF THE MAYOR OF THE CITY OF PHILADELPHIA GEORGE W. Read More

Leave a comment

About this Entry

This page contains a single entry by Yoz published on March 21, 2004 5:39 PM.

When you're holding Excel, everything looks like a spreadsheet was the previous entry in this blog.

Sex-Crazed Brits Just Doing It Everywhere, Like, Everywhere Man, You Can't Stop Them, They're Like Dogs In Heat Or Something, And Dude, I Gotta Get Me Some Of That is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 4.01