Don’t be afraid of the tool box

Posted By on January 8, 2012

Last night I was browsing through questions on Stack Overflow when I came across the statement “I don’t want to use any modules, I want to learn.” I would counter with: learn to use modules.

Reading this actually took me back to my early days of programming and falling into a very similar trap. It’s true that when you use modules you are now depending on someone else’s code and it does create a dependency, but installing perl modules is extremely simple and they can be used without root or admin access on a system so they should not be a roadblock in making code useful. The one area of caution would be in using a module that does a lot for something very simple. If you simply want to extract a list of file extensions from an array of file names, you probably don’t need to use File::PathInfo, although you could.

If you’re curious about how a module works open it up and look at the code. Most of the best things I’ve learned about programming have come from looking at how other people do things. If you find something the could be improved, don’t abandon the module. Instead, fix it and offer the patch to the author. If it’s merged in then you’ve contributed back to the Perl community and everyone benefits!

But you shouldn’t be afraid to make use of modules. Doing so is ignoring some of the best tools in your tool box. At the least it’s like avoiding the use of an electric screwdriver in favour of a hand powered one. Sure, you could do it, but it will probably cost you a lot of time and effort.

About the author


2 Responses to “Don’t be afraid of the tool box”

Leave a Reply to Laura