Archive for December 2009

Catalyst: Accelerating Perl Web Application Development

December 28, 2009

If you are a Perl fan that is looking for ways to developing high quality Perl Web Applications, Catalyst: Accelerating Perl Web Application Development is one book you should consider for your library. This is an introductory book to Catalyst, an open source web application framework written in Perl. With it you will get a good understanding of the Catalyst framework, its MVC (Model-VIew-Controller) architecture, and how to create web applications using Catalyst. All chapters start with an introduction followed by step-by-step instructions to accomplish the chapter’s goals. The chapters ends with a summary of what was learned to ease the learning process.

Chapter 1, “Introduction to Catalyst”, explain the need of using a MVC framework when developing web applications. It also explains how Catalyst fulfills that need. This chapter also discusses the Catalyst architecture and how to get it installed in Debian-based Linux, FreeBSD, OpenBSD, and Windows using ActiveState.

Chapter 2, “Creating a Catalyst Application”, shows you how to do the Hello World! Application using Catalyst. The most useful elements of this chapter are the description of the directory structure and the description of the files in the different directories. As a bonus, this chapter includes a brief introduction to SQLite.

Chapter 3, “Building a Real Application”, discusses the steps required to create a basic but extensible AddressBook. Among the steps discussed are environment setup, database design, and creating an Index, and Non Found pages. Of particular interest are the section on a CRUD (Create Retrieve Update Delete) interface to delete a person’s information from the database and the section on Forms to add information to the database.

Chapter 4, “Expanding the Application”, explains how to use configuration files to add value to the AddressBook developed in Chapter 3. Sessions, authentication, and authorization are added to personalize the Address Book. Also, searching and paging functionalities are incorporated into the Address Book to facilitate locating information.

Chapter 5, “Building a More Advanced Application”, describes a tool (ChatStat) for tracking opinions expressed in a popular Perl IRC Channel (irc.perl.org). Of key interest in this chapter are the section on extracting data from the IRC Channel and the section on manipulating the data to make sense of it.

Chapter 6, “Building Your Own Model”, deals with different ways of accessing the accessing the database models. The options explored in this chapter are: (1) mixing a procedural interface with a relational DBIx::Class interface, used to enhanced the AddressBook Application; (2) writing a database interface without DBIx::Class for the AddressBook; and (3) building a custom Model that does not use a database at all (this model was used to create a simple Blog application).

Chapter 7, “Hot Web Topics”, focuses on adding interactivity and improving responsiveness to web sites. The chapter deals first with adding a REST API to the AddressBook application so that API clients can easily look up people and their addresses. Authentication is handled by using username and password. Next, the AddressBook application user interface is modified using Jemplate to allow users to edit addresses in place. The final topic covered in this chapter is RSS feeds. The XML::Feed CPAN module is used to add an RSS feed to the mini blog application described in Chapter 6.

Chapter 8, “Testing”, deals with automating testing of Catalyst applications. The author starts the chapter by promoting “test driven development”, which suggests writing the tests before writing the code. The author, then, how to test applications outside Catalyst using as an example the testing of the message parser and the database of the ChatStat application. Next, the author describes how to test the ChatStats web interface using Test::WWW::Mechanize::Catalyst. After that, the author tests the AddressBook application using a test user and Selenium RC, a portable software testing framework for web applications.

Chapter 9, “Deployment”, teaches how to get a Catalyst application from development to production. Makefile.pl is used to manage dependencies and to create packages. PAR deployment is discussed for cases in which the development and production environment are at the same platform. Configuration management and performance issues are also discussed.

In short, this is a well written book with lots of tips to get started with Catalyst. Even though it has many typos, it would certainly be a good addition to your library of Perl books.