Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: XML::Simple Output

by Cody Pendant (Prior)
on Nov 19, 2003 at 05:40 UTC ( [id://308226]=note: print w/replies, xml ) Need Help??


in reply to XML::Simple Output

I'd say this is rapidly becoming a Frequently Asked Question, and I say this in all humility because I've asked it myself. I've definitely seen it a couple of times lately.

Is there a place for this in Q & A?

Why does this module require two attributes to be set in order to make output have the same structure as input? I'm not complaining, I genuinely want to know. It's not terribly simple in that respect at least.



($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss') =~y~b-v~a-z~s; print

Replies are listed 'Best First'.
Re: Re: XML::Simple Output
by grantm (Parson) on Nov 19, 2003 at 09:05 UTC
    Why does this module require two attributes to be set in order to make output have the same structure as input?

    XML::Simple is optimised for reading XML. Some of the things it does to make your life easier when it reads XML make things more difficult if you try and write XML back out again. But if you're anything like me then you read XML far more often than you write it. The two operations have very little in common so one tool is unlikely to be well suited to both.

    I'd be the first to admit that the XML::Simple API is a mess. The primary reason is that it wasn't planned as a general purpose XML manipulation tool. It was designed for reading XML config files. The code to write XML back out again was added on later. If I had set out to write a tool that could round-trip XML perfectly every time then I would have ended up designing some sort of DOM-type thing and at some point I would have seen the error of my ways and given up.

    I'd say this is rapidly becoming a Frequently Asked Question

    Perhaps, but I'd wager that most people who are asking have not read the XML::Simple documentation sitting on their own hard drive, or the XML::Simple FAQ sitting next to it. The original poster for example had a choice of 22 options and apparently didn't even try one! The ForceArray option which would be one solution to the original question is even singled out in the documentation as one of the two most important options you need to read about before you use the module. You can lead a horse to water ...

      Hi, thanks for that. I think part of the problem is that baffled, frustrated people who are just getting started with XML see something called XML::Simple and think it's the answer to all their prayers. I know I did.

      Maybe I could suggest putting this one particular issue in the POD?

      And you know what? I just clicked on the link to the XML::Simple::FAQ on search.cpan.org and it's a 404...



      ($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss') =~y~b-v~a-z~s; print
        I think part of the problem is that baffled, frustrated people who are just getting started with XML see something called XML::Simple and think it's the answer to all their prayers.

        Hoping that something will be both simple and the "answer to all their prayers" is surely a bit naiive. Take for example LWP::Simple. It certainly provides a simple API for retrieving web-based objects but if the "answer to all your prayers" requires cookie, proxy and authentication support then you've just outgrown the simple API and you have to learn a whole new one. Similarly if/when you outgrow XML::Simple, you need to move up to something offering more fine-grained control, such as XML::LibXML.

        Maybe I could/should suggest putting this one particular issue in the POD?

        The most common complaint I get about the XML::Simple documentation is that there is too much of it. Seriously. People email me with a question that they strongly suspect is answered in the POD but there is so much POD that it's quicker to email me (or post on PM) than sit down and read it.

        But you're right, I could improve the POD's coverage of round-tripping.

        And you know what? I just clicked on the link to the XML::Simple::FAQ on search.cpan.org and it's a 404

        That is odd. If I go to the main screen for the XML::Simple distribution then the link works. But that's a little bit of a red-herring - why search the web for documentation that's already on your hard drive? Especially when the one you find on the web might be for a different version than the software you have installed

Re: Re: XML::Simple Output
by PodMaster (Abbot) on Nov 19, 2003 at 08:32 UTC
    Is there a place for this in Q & A?
    XML::Simple already has a FAQ (in addition to complete documentation), so I'm not so sure (the Q&A section is not exactly a module specific FAQ).
    Why does this module require two attributes to be set in order to make output have the same structure as input? I'm not complaining, I genuinely want to know. It's not terribly simple in that respect at least.
    That's how the module works (ask the author).

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-19 00:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found