http://qs321.pair.com?node_id=61317


in reply to RedWolf MonkChatter

You should really use an XML parser (what else would you expect from me ;--). On top of the reasons given in On XML Parsing, if the format of the CB changes even slightly you will have to update your code (think about an extra attribute for each message). If you used an XML module you would have a much better chance to survive those modifications. Plus learning how to use one of the XML modules is a Good Thing (tm).

2 more points: I don't find XML::Simple difficult to install. I would not use the xml bundle. Either get XML::Parser 2.27 which comes with expat or get XML::Parser 2.30 and expat from http://sourceforge.net/projects/expat/ and compile it, install XML::Parser get XML::Simple, install it et voila!

Then I am not sure I would want to use XML::Simple for the CB. The problem is that it will create an unordered list of messages, that you then have to order on the time field. I would probably use XML::PYX to get the messages in the right order. OK, I'm lying I would use XML::Twig, but maybe starting with PYX would be easier.

Update: epoptai below is right, XML::Simple actually stores the messages in the proper order. I would have sworn I saw them messed up the other day. I would still try another method, if only to get a break from the ubiquitous XML::Simple ;--)

Here is how XML::PYX outputs each message in the CB:

(message Aauthor strredwolf Atime 20010228082806 -\n -OK, I'm convinced, I will use XML::PYX )message

Easy to process isn't it?