Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

ziggy (25)

  (email not shown publicly)
AOL IM: ziggyatpanix (Add Buddy, Send Message)

Journal of ziggy (25)

Thursday October 05, 2006
08:47 PM

More on Perl and XML

[ #31231 ]

As I mentioned in my previous post, using XML to avoid writing a parser is a bad thing to do.

This reminds me of a conversation I had with gnat many years ago. He asked why Perl was always lagging behind in its XML support, since Java was all over XML, and everything was moving over to XML faster than light speed. My response was that perhaps this was just a sign that Perl doesn't need bleeding edge XML support because Perl isn't used in the places where everything is moving to XML.

At the surface, that explanation seems right. Perl has always been strongly associated with system administration, and system administration is one of those domains that's XML hostile. (and for good reason; where's the benefit?) Perl is also very good at slicing and dicing raw text (like log files, random bits of malformed HTML, nm output, whatever), so it doesn't need everything shoved into an XML format just to avoid writing a parser or using a regex.

Now, ~6 years later, the answer is clearer. Perl doesn't cleave tightly to XML because it doesn't need to.

If you look at how XML is abused as a means to avoid writing a parser, one of the most common abuses is as a means to add a measure of dynamism to languages like Java. Perl doesn't need to do that, because it's a dynamic language. Need to extend a class with a new method? Just do it. No need to implement a forrest of classes just to use XML to pick one and reconfigure it on the fly.

Another common XML abuse: serialization. If you have no natural means of representing data, XML is as good as anything. More readable ASN.1 or other binary representations. Not as terse or as clear as JSON or YAML. But if you have a natural way evaluate expressions (like, say, eval), then all that's necessary is a module to serialize data in a manner that plugs into the evaluator (like, say Data::Dumper). Sure, this is a means of using eval to avoid writing a parser, but doesn't require using XML just to avoid writing a parser. (This may not be a bad thing; Lispers have done this for decades.)

So, Perl and XML aren't joined at the hip simply because they don't need to be.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.