|more useful options|
Thoughts on making modulesby BrentDax (Hermit)
|on Dec 22, 2003 at 08:24 UTC||Need Help??|
I apologize if this meditation is somewhat rambling, but free association is a valid meditation technique, right? ;^)
Nearly a year ago, when the feature was first discussed, I posted Perl 6's part(). For those who aren't aware, part() is a new built-in that will come with Perl 6; it's essentially used to categorize ("partition") a list, dividing it into several lists based on an index returned by a coderef.
Since then, I've drifted away somewhat from the Perl community, mostly into message-board RPGs. It's not that I haven't been hacking Perl in the last year, merely that my "community time" has been spent elsewhere. Well, this weekend the board I've been spending most of my time on went down for upgrades. With winter break and nothing to read either online or off, I revisited the Monastery and looked over some of my old nodes.
The node above came to my attention; I realized that, although I had perfected the essentially-four-line function eleven months ago, I'd never done anything with it. So I spent today packaging it up into List::Part.
The most important thing for getting this finished was one that I did at the very start: I used h2xs immediately to create the directory I would build the module in. Why is this so important? Because it builds all the little auxilary files for you. If I had just sat down and hacked, like I often do when I feel like making a module, I would have stopped when it was time to build all those little files, simply because I wasn't sure where to begin.
I don't know about other people, but this is a chronic problem for me: I stop working on a module when I'm finished and have to build all the other files around it. The same is true of the related case, where I make a module for one program and then realize it's generally applicable. I'm not quite sure what would fix this; perhaps a new h2xs mode that worked with an existing .pm, or a different tool. Maybe it's something I haven't thought of. Maybe it's even just that I need to discipline myself more. Thoughts on this?