January 2012 Archives

Skipping Test::Class tests in abstract base classes

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:


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.

Beginning Perl - Table of Contents

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.

About Ovid

user-pic Freelance Perl/Testing/Agile consultant and trainer. See http://www.allaroundtheworld.fr/ for our services. If you have a problem with Perl, we will solve it for you. And don't forget to buy my book! http://www.amazon.com/Beginning-Perl-Curtis-Poe/dp/1118013840/