Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Wednesday October 09, 2002
06:35 PM

True Laziness

[ #8285 ]

Most people know that Laziness is one of the Principle Virtues of Programming. We create programs to help us do less work.

Awhile ago I read The Botany of Desire: A Plant's-Eye View of the World. Michael Pollan starts with the notion that plants rule the world, then shows four cases in which plants trick us into spreading their DNA all over the world. The animals do the hard work and the plants just sit there. That's another sort of Lazy---get someone else to do it.

This works in software development too, especially in open source situations. Need to solve some really hard problem? Do not do it yourself but trick other people into doing it for you.

To solve your really hard problem, halfway implement it as a Perl module, then upload it to CPAN. Sit back and watch the patches come in.

I've been working on Test::Prereq for the last month so I can make sure that I put in PREREQ_PM all the modules my distribution uses. Until last night it had a problem. If I used a module like Tk:Frame, but put in PREREQ_PM 'Tk', Test::Prereq should figure out that Tk::Frame is part of the Tk distribution. Test::Prereq was not doing that though.

I had not gotten that far with Test::Prereq and did not have a pressing need for it, but Slavin Rezic did, and he sent me the patch. Once I saw the patch I thought "Of course that's the way you do it". Just use to expand distributions.

my $mod      = CPAN::Shell->expand( "Module", $module );
my $distfile = $mod->cpan_file;
my $dist     = CPAN::Shell->expand( "Distribution", $distfile );
my @found    = $dist->containsmods;
push @dist_modules, @found;

Slavin is not the only one sending me patches. Iain Truskett made Test::Prereq work with Module::Build. Various CPAN testers send minor fixes with each new upload.

Scott McNealy may say that the network is the computer, but I say the community is the programmer if you let yourself be a vegetable and trick other people into doing your work.