why do well when you can just skate?

Don’t look at that CPAN module!

Can’t use CPAN modules? If you can’t, you have company, whether you want it or not. CPAN Dependency Hell is a real problem, and it’s much worse if you’re an experienced Perl programmer. Management might want to clamp down on third-party, unsupported code. Lawyers might be afraid. I don’t want to get into that bit though. I’ll concede, for the purposes of this post, that these people can’t use any CPAN module.

So, they have to do something that a widely-used and widely-recommended CPAN module already does. For instance, they want to parse comma separate values, or they want to extract some text from HTML. They know they can’t use CPAN modules, so they don’t bother looking at CPAN. But, they don’t know how to do it themselves. They think about it for seven minutes. They don’t figure it out. What’s next?

Naturally, they go to Perlmonks or Stackoverflow and ask if there’s an easy way to do the same thing that the module does. That makes you a lazy Defective unworthy of their job. Instead, they are Help Vampires who shift their paid time to your unpaid time.

Their reasons vary. Some people think everything has to live in one file, even if they are using core modules. That’s fine. Copy the source out of the CPAN module into a single file. It’s actually not that hard to install every pure Perl thing that they want to use, concatenate all of the Perl module files you use, and include that in your program. They can fake %INC to think that the modules are already loaded. That’s not even counting things like PAR or Carton.

That would require some Perl knowledge, though, and some people avoid that when they can. They want the next problem to be just as hard, if not harder, than the current one. If they don’t want to copy the source, they can at least read it. If they can’t use the module, they can look at how the experts have done it and do the same thing. But, that requires the ability to read code, and maybe do something that doesn’t involve typing.

Just because they can’t use that source doesn’t mean they can’t mine it for ideas. However, there’s this fantastical thinking that there is some quick hack that will do the same thing. Surely every module is over-engineered (some are, truly), overly-cautious, and even too correct. All that code in those modules doesn’t do anything. Perl can do anything in one statement, can’t it? Why do these module authors work so hard and write so many tests?

It’s much better to ask people who don’t do it correctly (module or not) to guess at a solution. So, they ask, and then they wait for the unsatisfactory answers to come in. There are the tired experts and experienced practitioners worn out by these questions, who just tell them to use the modules. There are the newbies who guess at solutions that cover only the 3% of the problem they’ve ever encountered. Half of those think that input data never change, so their special case guesses are rock solid. They’re content to punt the problem to the next person, using the IWBHWIB (“I won’t be here when it breaks”). They’ve already got their next job, with adequate references, before anyone notices.

There’s another sort of defective programmer, the NIH variety, and I don’t mean those who work at the National Institute of Health. These are the “not invented here” types. Sometimes these Defectives just can’t accept that anyone is smarter than them. They get wrapped up in the ego competition or some notion of purity. Everything has to work just so. But, it’s never the best code that wins: it’s the good enough code that gets the job done at the right time. With appropriate use of interfaces, they could use CPAN modules at first and replace them when they have time.

1 Comments.

Is mining CPAN modules still a good idea if nervous lawyers are the reason you can’t use CPAN? Or rather, should you bear the module license in mind before mining?

My suspicion is that it would be okay as long as you’re using the module as an example to reimplement, but copying and pasting might not be such a good idea. I’m not sure, though. Some corporate structures are hard to get used to when your normal practice is just to cowboy in with some CPAN module, even after a couple years on the job. 🙂