|more useful options|
Perl Monks += TMTOWTDIby hacker (Priest)
|on Apr 14, 2003 at 13:17 UTC||Need Help??|
How many times have you seen or heard a conversation like this?
<foo> "I'm trying to use Module::Thing, and I'm running into trouble with the constructor. Can someone help?"
I've noticed this type of evolution many times over the last several years, where one (still useful) module has been deprecated by another module with similar or additional functionality. How do you know which module best fits the job, unless you can talk to people who walk around the halls of CPAN on a daily basis and poke at module innards?
Without the human interaction and experience provided by a site like Perl Monks, this really wouldn't be as possible as it is with. IRC is a good medium for "real-time" exchange of information, but IRC doesn't have Super Search!
I ran into this very recently with a script I wrote that used LWP::UserAgent, HTTP::Cookies, and HTML::TableExtract to log into PayPal and extract some payment statistics for me. The code worked, but was a bit longer and more convoluted than I would have liked. Enter WWW::Mechanize, which allowed me to reduce the modules used from 5 to 3, and cut the amount of code down by 2/3, and add a bit of additional functionality, in less than 75 lines.
If I hadn't talked to bart and Corion and some others who had used these kinds of modules before, I would still be rolling around with the stock LWP modules and doing hand-parsing of the content itself.
Another example which just came up in the ChatterBox was an example of validating a URI through the use of Regexp::Common and Regexp::Common::URI::http. I've been using the stock URI module to do this, splitting out the scheme and authority section, but now I see where Regexp::Common could be a better use of it. I would never have known about it unless bart or broquaint had mentioned it.
Another one from yesterday was Pod::Usage. I never knew you could dump the pod from within a file itself, without having the user interactively run 'perldoc ./foo.pl' on the code. Thanks to the experience and insight of Enlil and tye, I've learned a "better way", and I shortened my code in the process.
Yet another, HTML::LinkExtor, which works well for extracting links from HTML pages, but can also be done (with much more robust functionality) using HTML::TreeBuilder. Granted, most of the modules I'm mentioning are HTML or "web" related, but that's the space I play in right now. I know this pardox exists across all of perl, however.
What do other monks do when there is the possibility of a "better path to walk" with code and modules?
How do you know which module is "right" for the task? (or wrong for the task)
How do you search for something by name, which can only be described by concept?