Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: XML::Simple needs to go!

by Mr. Muskrat (Canon)
on Dec 21, 2015 at 15:16 UTC ( [id://1150861]=note: print w/replies, xml ) Need Help??


in reply to XML::Simple needs to go!

Rather than trying to get rid of XML::Simple, why not submit documentation patches that better explain the problems that you see here and on Stack Overflow?

Despite all of its warts and all of the other fine modules for handling XML, XML::Simple is still my go to module when I start a new XML related task. Why? Because after using it for so many years, it still is the easiest solution for me. It's the Pareto Principle; I want to get 80% results from 20% efforts. (I still switch over to XML::Twig if needed.)

I won't ask you to parse HTML with a regex if you don't ask me to give up a misunderstood tool from my toolbox.

Replies are listed 'Best First'.
Re^2: XML::Simple needs to go!
by Preceptor (Deacon) on Dec 21, 2015 at 16:19 UTC

    This is where you've lost me. It may be I am misunderstanding XML::Simple - but I'm fairly sure that it's simply not possible to accomplish what XML::Simple is trying to do. XML intrinsically doesn't map to perl data structures.

    I have used XML::Simple - admittedly for the sake of troubleshooting, rather than by choice - and can think of very few positive reasons to use it (except maybe 'I have used it before, so I'm more familiar with it'). Can you give me some positive examples?

      From the documentation: "XML::Simple - An API for simple XML files" which is different than "A simple API" and is where much of the issue arises I suspect. XML::Simple is good (I understand) for configuration files where otherwise you might use .INI files or something similar.

      However XML is a bad choice for configuration files anyway. In fact it's a bad choice for most things. JSON and YAML do a much better job in many of the situations where XML has been bent to fit. XML::Simple is fine in its intended role, but that role doesn't match the advertising on the box nor the expectations derived from similar boxes.

      Premature optimization is the root of all job security

        Thing is - I honestly believe that even for simple XML, it's still making more complicated code than the alternatives. We've got XML for all sorts of stuff - like config and API calls - it works well enough, although I would agree that for most, JSON or YAML are better (depending on precise circumstance).

        The root of the problem I think is indeed - that people _don't_ read the doc, they just see "Simple" and install that and start hacking away

      As GrandFather has already said, XML::Simple is good at dealing with simple XML and XML configuration files. Most of the XML that I have had to deal with was configuration files. Lots of software is guilty of using XML for this (just Google it).

        But here's my problem - I don't think it is "good" at it. It's merely just about capable of dealing with it.

        I too run into XML in all manner of places - config and API calls primarily. I've also been tripped over by places with annoyingly fussy change control, that inhibit additional module installation.

        Problem is - there are no XML parsers on the core list. In either case, it's an additional install (which granted, may come bundled with an OS perl, thanks to dependencies - of which there are more for XML::Simple I think).

        I have honestly yet to see a scenario where the XML::Simple answer was the 'better' one.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1150861]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2024-04-25 10:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found