Book Reviews

The following book reviews are the copyright of their respective authors and no part should be reproduced without the express permission of the author. Publishers and Authors of the books reviewed may reproduce the whole or extracts of a review for their book. To request copyright permission please email

All the reviews herein are the opinions of the reviewer and are not necessarily the views of Birmingham Perl Mongers and its members. If you feel a review or comment has been made in error, please contact to rectify the situation.

Perl Books

Static Link:

Perl & XML
Title:Perl & XML
Author(s):Erik T. Ray & Jason McIntosh
Publisher:O'Reilly Media
Reviewer:John Preece

This book will interest anyone who has a basic understanding of XML and wants to see the full potential. The problems arise however as the reader is increasing frustrated when the examples require tweaking to get them to work properly. It becomes apparent that the examples were written on a non-windows system. Although no mention of this is made under the assumptions.

That aside the book is very clear and concise and allows the user to jump straight in with an example on page 3, straight from the kick-off using XML::Simple. The example highlights an important point in that there is a trade-off between simplicity and completeness. As the developer, you decide what's essential in your markup and what isn't. Sometimes the order of elements is vital, and then you might not be able to use a module like XML::Simple. Or perhaps you want to access processing instructions and keep them in a file. Again, this is something XML::Simple can't give you. Thus, it's vital that you understand what a module can or can't do before you commit to using it.

Chapter 2 offers the reader a quick background recap of XML, where it came from, how it's structured, and how to work with it.

Chapter 3 covers the two most important tasks in working with XML: reading it into memory and writing it out again. This chapter houses the basics of XML and as such comes with lots of examples, introducing the reader to various modules XML::Parser, XML::LibXML, XML::Xpath and XML::Writer to name but a few. It also discusses the differences of Unicode Encodings. All in all a very important chapter if you want to progress your XML programming.

Chapter 4 analyses event streams. A stream being a sequence of data chunks to be processed. XML streams are just clumpy character streams. The importance of this is that it makes the user start to think about well-formed XML. The book then highlights stream processing and the benefits of this before moving onto XML::Parser, the first, fast and efficient parser to hit CPAN. The example in this chapter is what you will refer to whenever you want to parse XML.

Chapter 5. Just after all your XML problems have been solved SAX is thrown at you, stating that this is the future as it is a multiplicity of parsers that cover any situation you encounter. Once again problems arose here with the examples, which was a shame as I deemed this chapter as being very important.

Chapter 6 Tree Processing moves the user on from letting the XML fly past the program one tiny piece at a time, to capturing the whole document in memory and then working on it. It then introduces the user to XML trees including the Document Object Model (DOM) and fast access to internal document parts with XPath.

A whole chapter is allocated to DOM, to underline the importance of getting sound background knowledge before progressing. DOM is a recommendation by the World Wide Web Consortium (W3C) and is designed to be a language-neutral interface.

Chapter 8 introduces us to XSLT, which makes tree processing easier, faster and more efficient. I currently use XSLT with an ASP website, so I was interested in what this chapter said about it. XSLT is more than a step in formatting; it's an important XML processing tool. The book then shows you how to combine XSLT with Perl to do powerful XML munching.

We then look at XML applications that already have a strong presence in the Perl world. In particular RSS and SOAP, complete with detailed examples.

Chapter 10 then takes you on a concluding tour through the world of Perl and XML, with it's strategies and it's gotchas, before sending you on your way.

All in all this is a good book. I was disappointed with the examples early on, but found that as I progressed through the book, my understanding increased dramatically. I have since used many of the examples for reference as my workload changed and found that the parsing of XML was a necessity.

- John Preece, April 2004