|Perl: the Markov chain saw|
XML::Simple needs to go!by Preceptor (Deacon)
|on Dec 21, 2015 at 10:18 UTC||Need Help??|
If there's one module that I think really needs to get thrown out of CPAN, it's this one. Why? Well, generally I'm forgiving - don't like a module; don't use it. Problem is - XML::Simple is false advertising - it commonly gets installed because it's "Simple", and that's simply not the case at all.
I see a steady stream of questions - both here and on Stack Overflow - about this module, because someone's been tripped up again by how this module tries to coerce a more complex data structure into a less complicated one.
That's really the root of the problem - just like parsing HTML with regex - the approach is fundamentally flawed.
You can use regex to grab a value out of HTML/XML. It's nasty and brittle, but sometimes a dirty hack is expedient.
And the same is true, I contend, of XML::Simple - it's the 'parsing with a regex' sort of solution. In that it can sort of work, in some scenarios but pretty fundamentally it's a bad solution to the problem at hand.
But were the module called anything else this wouldn't be a problem. There's a lot of stuff in the CPAN namespace that I've never used or installed - that's fine, that's kind of the point.
But many an unwary newbie has been caught out by it - there are a number of "Simple" modules that offer cut down interfaces for a limited subset of operations. LWP::Simple is a good example - it offers a cut down interface to the basic tasks one might need to accomplish with LWP.
Is there precedent for renaming a module in CPAN? I know it's not really an option to just delete it, because there's probably some legacy code depending on it (as much as I think they should be rewriting it, that isn't really my call to make!). But it really does suffer from all the things that have given perl a bit of a bad name in the past - it's a sure road to some rather hacky/nasty code.