By Ovid
on January 6, 2012 10:26 AM
With the latest release of Test::Class::Most, I added the is_abstract feature. With this, you can declare a test class like this:
package TestsFor::TV::Episode::Broadcast;
use Test::Class::Most
parent => 'TestsFor::TV::Episode',
is_abstract => 1;
is_abstract is a non-inherited property of a test class which says "I'm abstract" (no surprise there) and you can check it with:
Test::Class::Most->is_abstract($some_test_class);
The reason for that is simple. Imagine you have a TV::Episode class, but it's an abstract base class which should never be instantiated. You actually have a TV::Episode::Broadcast and TV::Episode::OnDemand classes which are the concrete implementations. You can make tests work in your test classes very cleanly with this.
By Ovid
on January 3, 2012 3:31 PM
Because people keep asking for it, I asked Wrox if it was OK to share the table of contents and they said "sure!".
Please note that this is in flux. Chapters 1 through 7 are written, along with most of Chapter 8. Everything after that is very much subject to change (which is why the TOC isn't even formatted for those chapters). Also, you'll note the lack of Unicode. That was going to be in Chapter 7, but I've moved it to Chapter 9 and haven't update the table of contents yet.
By Ovid
on December 30, 2011 11:01 AM
You may have seen this:

I had debugger syntax highlighting working before, but I overcomplicated it and never figured out how to approach the problem.
I was inspired to try again by Mithaldu's post about augmenting the debugger. Once I realized that I had a much better strategy than previously, the code was straightforward.
I tested it on 5.12.2. I offer no guarantees. It's on Github as DB--Color. You don't like it? Fix it :)
By Ovid
on December 29, 2011 8:04 AM
I wrote the following on Facebook:
I have a very good reason for including this regular expression in my book. It's a tiny part of a much longer one I once wrote.
(?x-ism:(?-xism:(?!\.(?![0-9]))(?:(?:(?i)(?:[+-]?)(?:
(?=[.]?[0123456789])(?:[0123456789]*)(?:(?:[.])(?:
[0123456789]{0,}))?)(?:(?:[E])(?:(?:[+-]?)(?:[0123456789]+
))|))\b|\b(?-xism:[[:upper:]][[:alnum:]_]*)\b))(?:\s*
(?-xism:(?:\*\*|[-+*/%]))\s*(?-xism:(?!\.(?![0-9]))(?:(?:
(?i)(?:[+-]?)(?:(?=[.]?[0123456789])(?:[0123456789]*)(?:
(?:[.])(?:[0123456789]{0,}))?)(?:(?:[E])(?:(?:[+-]?)(?:
[0123456789]+))|))\b|\b(?-xism:[[:upper:]][[:alnum:]_]*)
\b)))*)
At which point, many people piled on and criticized this without asking why I was going to include this. I should have known better than to make such a cryptic post and then head to bed, so here's the explanation.
By Ovid
on December 24, 2011 9:20 AM
In my chapter on subroutines, I need to explain recursion. One example program I give draws mazes recursively. Here's a variation of the program, somewhat expanded beyond the book example.