Starting to think about an 8th Edition

I’ve finished some other book projects (notably Learning Perl 6 and Mojolicious Web
Clients
), and it’s time to think about what I need to do to
refresh my other books.

The 7th Edition covers up to v5.24 and now we’re on to v5.30 (with
v5.32 soon). I track interesting new features at The Effective
Perler
.

Some notable things to include:

Updated Learning Perl, 6e ebook

There’s an updated O’Reilly ebook for Learning Perl, 6e. If you’ve already purchased the ebook, the update should already be in your O’Reilly account. I’m not sure how that works because my account has special author magic associated with it. If you don’t have an O’Reilly account, you can register your books for free.

When you report problems with the book, we usually have comments back to the publisher with a day or so telling them what to do about it. The next time our book gets built (I don’t know the schedule), you get the benefit of the fixes. The corrections should also show up in Safari. If (when) there is another printing of the book, that printing is also updated.

DocBook is a pig part of this process, and it’s going to get even better. O’Reilly has invested quite a bit in DocBook and their internal process to make the books from that. The only thing that keeps them from generating books more often is just human time. Someone has to take the list of corrections and fix them in the sources. If it’s an O’Reilly person, they have to rely on our comments about what they should do. The DocBook sources are in source control, though, and I have access to those, which means I can actually close problems by just fixing them. It takes me as long to do that as it does to explain the fix to someone. When I want to kick off a new build, I just do that.

Updates to Chapter 15, “Smart matching and given-when”

[This post notes differences between the fifth and sixth editions.]

The chapter on smart matching and given-when is the newest chapter, but also the one a bit out of date. Since we were writing the fifth edition right on the cusp of the release of Perl 5.10.0, we weren’t aware of all the problems that the new smart match feature had.

I did start to find problems, and I posted to perl6.language, perl5.porters and perlbug around the time we were turning in the book which hit the shelves in June 2008. It takes about four months to go from the end of writing to delivering the dead trees to the reader.

No one had an answer, and the next version of Perl changed quite a bit of the smart matching mechanism. For instance, see my p5p messages for [PATCH] perlsyn: equivalent code for HASH ~~ ARRAY and [perl #50538] when( @n && %n ) fails to smart match.

Updates to Chapter 5, “Input/Output”

[This post notes differences between the fifth and sixth editions.]

With the added emphasis on Unicode, we had to update the chapter on input and output a bit. If we are going to talk about Unicode, we need to talk about encodings, which expands the material on three argument open and brings in binmode too.

For this update, we also introduced filehandle references, although we did not call them references, really. We still present most of the chapter using bareword filehandles, and once we have covered everything we show how you can do the same things with filehandles in variables. However, we still save the meat of filehandle referencs to Intermediate Perl.

Some people think everyone should be using lexical filehandles all of the time, but even if you want to do that for new code, you still have to understand what people did in old code so we have to cover the legacy syntax (and some people would even object to calling it “legacy”).

Updates to Chapter 9, “Processing Text with Regular Expressions”

[This post notes differences between the fifth and sixth editions.]

I didn’t have to make many changes to this chapter. I wanted to put in at least one Perl 5.14 feature, but the only new thing that the substitution operator gets is the /r modifier.

While working through this chapter though, I started to wonder if our terms in the previous editions were the same in the Perl documentation. We called the modifiers “option modifiers”, and sometimes “flags”, perlre just says “modifier”. Personally, I’m used to saying “flag” all the time and I like that term just fine, but for regular people, there’s nothing to connect the everyday use of “flag” to the thing after the match operators. So, “modifier” it is. I’d much rather use “adverb”, which is popular in Perl 6 land, but it’s a bit late for Perl 5 to change terms. When I made the switch in this chapter, I had to go back to Chapters 7 and 8 and do the same thing.

This chapter is also curious in that it ends with a long example the builds up to a perl one-liner. One of the things the reviewers noted about a new edition was a new chapter devoted to one-liners. That’s still possible, I guess.