Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Writing Perl Modules for CPAN

by TStanley (Canon)
on Aug 19, 2002 at 23:24 UTC ( #191338=bookreview: print w/replies, xml ) Need Help??
Order Writing Perl Modules for CPAN

Item Description:

Review Synopsis: Learn about the CPAN, and the techniques for writing a module worthy of the CPAN

Author:Sam Tregar

  • About the Author
  • About the Technical Reviewer
  • Acknowledgements
  • Introduction
  1. CPAN
  2. Perl Module Basics
  3. Module Design and Implementation
  4. CPAN Module Distributions
  5. Submitting your Module to CPAN
  6. Module Maintenance
  7. Great CPAN Modules
  8. Programming Perl in C
  9. Writing C Modules with XS
  10. Writing C Modules with Inline::C
  11. CGI Application Modules for CPAN
  • Index

The author starts off with a quick overview of the CPAN, describing its purpose, design, and history. He also describes how to browse, search, and install modules from the CPAN, using the CPAN module from the Perl distribution. He also makes note of the Perl Package Manager (PPM) from ActiveState, and gives short examples on how to use it.

The second chapter deals with the basic workings of modules, such as packages and symbol tables, and makes note of where the differences between Unix and Windows exist when applicable. He also covers the basics used in most common modules, such as tying scalars, hashes, and arrays, operator overloading, and the basics of object oriented programming.

The third chapter covers the design and implementation of modules. He starts off with the point of checking CPAN for existing modules. “CPAN is the greatest enabler of programmer laziness since the terminal!” He also makes an excellent point for documenting the module first. “If you can explain it in the docs, then there’s a good chance you’ll be able to code it”. Also covered in this chapter are parameter passing, exporting, and inheritance. He also makes use of the Class::Struct and Class::MethodMaker modules, which can be found on CPAN.

Chapter 4 touches on module installation as well as creation. For creating a basic template for a module, the author emphasizes the point of “Always begin with h2xs.” As he points out, it will save the programmer a lot of trouble, and he goes into some detail about its most commonly used options and the files that are produced from them.

Chapters 5 and 6 deal with actually submitting your module to CPAN, and some general guidelines and ideas, to help maintain the module once it is submitted. He discusses the Perl Authors Upload Server (PAUSE), how to obtain a CPAN ID, and registering your namespace. For the maintenance side of things, he covers the various methods used, such as email lists, emailing the author, using the diff command to generate patches, and refactoring of code. He also touches upon the Concurrent Version System (CVS), describing what it does, where it can be found, and giving some basic commands for its usage.

Chapter 7 is a showcase of some of the most well known (if not most used) modules found on CPAN. Listed in the number one spot is the CGI module, followed by DBI and Storable. Also listed are Net::FTP, LWP, XML::SAX, and Parse::RecDescent.

The next three chapters deal with programming with C and with XS. And both are subjects the author is obviously quite familiar and comfortable with. He covers the basics of the Perl C API, and works with the Gnome::MIME module in his chapter on XS. He also uses the Inline::C module to insert C code into the middle of a perl module.

The final chapter of the book deals with the CGI::Application module, which allows the programmer to create flexible code that can be used on multiple projects.

Overall, this book was very well written, with no obvious errors or typos, and the material was up-to-date. The only problem I had with this book, was that I felt not enough information regarding the creation of modules for Windows distribution was given out. However, the author did point out in the beginning of the book that it was primarily geared towards the Unix distributions.

I would heartily recommend this book to anyone who is considering releasing a module to CPAN.

Update:This review can also be found on

Replies are listed 'Best First'.
Re: Writing Perl Modules for CPAN
by samtregar (Abbot) on Aug 20, 2002 at 02:24 UTC
Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: bookreview [id://191338]
[Corion]: They are aware of so many facts, they created systems to abstract them ;)

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2017-05-30 07:46 GMT
Find Nodes?
    Voting Booth?