XML::Simple for Perl Developers
An anonymous reader writes "XML has become pervasive in the computing world and is buried more and more deeply into modern applications and operating systems. It's imperative for the Perl programmer to develop a good understanding of how to use it. In a surprisingly large number of cases, you only need one tool to integrate XML into a Perl application, XML::Simple. This article tells you where to get it, how to use it, and where to go next."
XML::LibXML is where it's at, it is a) quite a bit faster and b) has a sensible interfce rather than giving you useless empty hashrefs in the middle of a tree.
Stop intellectual property from infringing on me
No, professionals write good code, regardless of the language. There is just as much shitty Python/Ruby out there as there is Perl.
"Outside of non-professional teenage Slashdot readers who still think the shitty Perl syntax is 'kewl', who the hell cares about the language anymore?"
...
I usually don't reply to trolls, but
The answer is hundreds of thousands of people around the world who use the correct tool for a given job, rather then trying to hammer in screws with the "latest and greatest".
PS, if you're not clueless and actually are a professional software developer, you can write code in perl that is every bit as readable as . It even supports comments!
- Roach
(Who writes code in perl, as well as a number of other languages depending on the task at hand.)
This is the most pointless article I've seen linked from slashdot in a long time (and yes, I've seen a lot of crap here). What is the point of posting a run of the mill tutorial on something that's been covered many times before?
Having spent a lot of time playing with this crap lately, can I just butt into this pointless thread and say screw XML, use YAML or JSON instead. XML is a steaming, clumsy overrated turd. I benchmarked XML::Simple against YAML::Syck - the latter encoded 2.5 times faster and parsed nine times faster than XML::Simple. The syck library is indeed aptly named.
"Leverage the power of XML" by deprecating it wherever you can for a more sensible cross platform format.
</rant>
-- Trinity in high heels carrying a whip: The donimatrix - there is no spoonerism
Slashdot.org!!
When information is power, privacy is freedom.
I don't know about GP, but I've got a couple hundred hosts that have PERL installed, but not Ruby or Python, and getting those others installed would require alot of work. (some technical, given the age and OS on some of them... but mostly configuration management style issues)
Since there is alot of PERL code already doing work in this environment, and PERL is on everything already... it makes sense to stick with what's there.
> The hubris needed to upend this core part of the language is pretty astonishing.
You mean like the first time he messed around with regexes? Now any regex implementation that doesn't have perl's features is considered a toy. And Perl is merely catching up to Snobol and Icon.
Perl will do fine despite ignorant fools who sneer at it. Perl6 is still headed to perpetually unreleased oblivion, but some features will hopefully break off and find their way back into perl5 and elsewhere. Regexes among them.
Done with slashdot, done with nerds, getting a life.
One thing I user it for was representing a database in XML. Once I had the DB layout in a datastructure, it was one line to print it out. Of course, this was before I knew about DBIx::XML_RDB...
-B
Ash and Hickory, straight-grained and true, make excellent bludgeons, dandy for the cudgeling of vegetarians.
Example: -> is changing to . The reason given is Which also forces . to change to ~ (also
Which also forces =~ to change to ~~
That's three major operators in the language changed with the justification that the rest of the world does one of them differently. Except, by definition, people who already knew perl.
GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
The fact that whitespace is dogmatized by the pyhon community makes the community
itself less attractive, and the language because of it. It sends the message that
it doesn't really matter what you want, the language is perfect and your code
is crap because you are too stupid to agree with how right the community is.
Guido could _easily_ put in some sort of pragma to allow other types of blocks, it's
only a matter of arrogance that stops him- coding with whitespace is the "right" way to do it.
There's also the matter of the parser. The last time I used Python everything was a syntax error, which gave little indication what was actually wrong with a piece of
code.
So you have never used APL, eh?
...), Basic, C, C++, Fortran (66,77,90,95), Gauss, Icon, Java, maxima/macsyma, mumath, pascal, perl, prolog, python, ruby, R, VB and probably a few I forget in there. The big idea I have learned is to never force fit a tool to a problem. Select the right tool for the right problem. And go from there.
...). It is not the perfect language for everything though, there are some missing bits.
... spent 15 years developing Fortran code. May it never reach 16 years.
Perl is derided by people who quite frankly don't have a clue.
We get lots of flammage from the Java and Python programmers that seem to be unable to grasp that when they try to justify their language choices by putting down other languages, they demonstrate how clearly idiotic their choices are. They cannot come up with something better than "line noise"? My god, have they not heard of the obfuscated code contest?
One can write unreadable code in any language. Perl is not unique in this regard. Moreover, Perl itself does not admit more unreadable code than other languages. The regex engine in Perl is a language unto itself. You don't need to use it, ever. But once you do, you realize how incredibly powerful it is. And you learn how to parse it, and even more scary, emit it, in your head. What takes hundreds of lines in Java (well what doesnt) becomes single digit number of lines in Perl.
In my career, I have used APL, Assembly (x86, 8080/Z80, 6502, 6800, F8,
Perl is wonderful in that it allows for rapid application development, has a really huge library to draw from (www.cpan.org), orders of magnitude larger than competitive languages, an active developer base, an active contributer base, is portable (you can run Perl anywhere, windows, linux, mac, Cray, AIX,
Ruby is neat, though I am amused by those in the Java community running over to it, thinking it is better than Perl. It is slightly different, but the syntax is actually quite close to perl. Learning it isn't hard once you know Perl, you can go back and forth quite easily. The problem in Ruby's case is speed. This hopefully will improve over time.
Python is hard for me to use. I am reminded of BASIC on IBM PCs. Some people like it, I don't. Use it if you must.
Java has always felt to me to be a solution in search of a problem. I haven't seen things that are being done in Java that couldn't be done more quickly and efficiently in other languages. Java has developed a cult-like following. Many people drank the koolaid, committed company resources to it, and poo-pooed other, better solutions. Only to discover that each "advance" meant to deliver more performance dug people in deeper to the hole, made the systems harder and more expensive to develop. And until recently, the vast majority of people were in significant denial over the fact that java was and is just a marketing gimmick for Sun. They drank the koolaid.
Fortran
APL. You want write only? Parse this: +/x
In APL, we wrote complex calculation systems in very few lines. It was a tremendously powerful language.
In Fortran we wrote complex calculation systems in quite a few lines. Not very powerful for IO, really sucked for this.
In Perl we drive complex calculation codes written in almost any language. Insanely powerful. Expressive and concise syntax, reads well when well written. Good IO, good networking, good system hooks. Can use MVC and web tools, Jifty even comes with a pony.