Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Book Review: Higher-Order Perl


UnixReview.com
November 2005

Book Review: Higher-Order Perl

by Reinhard Voglmaier

Higher-Order Perl
Mark Jason Dominus
Elsevier Science & Technology Books, 2005
ISBN: 1558607013
$59.95

Perl is considered by many people as a scripting language', intended as a way to quickly write handy little scripts. However, it is also well suited for creating robust applications with object-oriented programming. The book Higher-Order Perl shows both of these approaches — creating extensible programs (not just scripts) using object-oriented features as well as functional or declarative programming techniques.

The book provides not only practice but also a lot of programming theory that you'll appreciate when writing applications. In spite of the theoretical background that the author provides, I don't consider this to be an academic book.

According to the author's Web site, "Higher-Order Perl is about functional programming techniques in Perl. It's about how to write functions that can modify and manufacture other functions. Why would you want to do that? Because that way your code is more flexible and more reusable. Instead of writing ten similar functions, you write a general pattern or framework that can generate the functions you want; then you generate just the functions you need according to the pattern. The program doesn't need to know in advance which functions are necessary; it can generate them as needed. Instead of writing the complete program yourself, you get the computer to write it for you."

Whats Inside

The book first explains recursive problem solving and the fundamentals of callbacks. Callbacks are also discussed in the second chapter on dispatch tables and recursion. The chapters build on each other so it is wise to read the chapters in order, rather than to jump back and forth.

The third chapter explains caching in detail using the "memoization" written by the author. Many people think Perl does not know about iterators, but the fourth chapter shows the theory and some useful examples. The following chapter shows how to convert recursive functions into iterators. After a chapter about infinite streams, the author presents the concept of currying and higher-order functions.

The chapter of parsing alone is worth the price of this book. I do not know a better text about parsing in Perl. The book concludes with a chapter about declarative programming, another highlight in this book.

Should you buy it?

Yes. Higher-Order Perl is one of the Perl books that should have a place on the bookshelf of every Perl programmer. It offers an in-depth understanding of important programming techniques and fundamental concepts. It contains a many useful examples available from the author's Web page, the same site where the author promises to publish the whole book.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.