I'm not going to preach that my idea is the only solution, and everybody should use it. I'm sure most people would prefer XML::Simple (which is a good module, but using it can be a bit annoying) or XML::Twig (which is great, and many thanks for it!).

The replies that I'm getting for my post is exactly the feedback that I wanted to get - in order to see if there is a need for a module like mine.

However, I do want to note that the problem I wanted to solve was not loading XML file, but quickly accessing the loaded data. With XML::Simple you have to constantly think about the actual data representation in memory (speaking from experience). And the moment you start using 'forcearray' all the initial easiness disappears. From that point on you have to assume that each element is wrapped by an anon. array. (IMHO) Person using module for reading configuration files should not need to think too much about underling data structures or XML.

I just think that it should be both possible and easy to access parameters in the XML configuration file using just a single line of code. Afterall, it's perl we are talking about ;)

P.S.: I gave that ugly example intentionally to demonstrate that using method access, you can get get ether just the first element or all of them. This is exactly what XML::Simple lacks.


In reply to Re: Re: Practical suggestion for accessing configuration data stored in XML format by fuzzycow
in thread Practical suggestion for accessing configuration data stored in XML format by fuzzycow

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.