NAME

ClassWithTestsAtTheEnd - Demonstrating putting synopsis tests at the end of an object class, perlmodlib-style

SYNOPSIS

my $foo = new ClassWithTestsAtTheEnd;

$foo->zonk();

DESCRIPTION

This is a dud class to demonstrate a particular use of Pod::Snippets that its author finds convenient (nay: way groovy actually).

First we have some foo-ness so that we can pretend we are a real package.

TEST SUITE

The test suite is introduced by the "unless caller" mantra straight from perlmodlib. "unless caller" means that the test suite won't even be compiled if we have a caller, that is, the library is being invoked with "use" or "require". If one executes the library directly (as in perl ClassWithTestsAtTheEnd.pm), the test suite is fired up.

We first put ourselves into a neutral package (eg "main") because the name of the package you are in at the beginning of an eval "string" is not consistent between Perl 5.6 and 5.8.

Now we do some testing.

But we also want to test the synopsis, right? It's also source code, right? Right.

Lo and behold, the <main::DATA> pseudo-file descriptor is seekable! This, people, is why I so love Perl :-)

THAT'S ALL FOLKS!

I can has Kwalitee now?