4 use Test::More tests => 11;
8 require_ok(File::Spec->catfile('examples', 'InstanceCountingClass.pod'));
13 This is a trivial and contrived example of how to
14 make a metaclass which will count all the instances
15 created. It is not meant to be anything more than
16 a simple demonstration of how to make a metaclass.
23 use metaclass 'InstanceCountingClass';
27 $class->meta->new_object(@_);
35 is(Foo->meta->get_count(), 0, '... our Foo count is 0');
36 is(Bar->meta->get_count(), 0, '... our Bar count is 0');
41 is(Foo->meta->get_count(), 1, '... our Foo count is now 1');
42 is(Bar->meta->get_count(), 0, '... our Bar count is still 0');
47 is(Foo->meta->get_count(), 1, '... our Foo count is still 1');
48 is(Bar->meta->get_count(), 1, '... our Bar count is now 1');
54 is(Foo->meta->get_count(), 10, '... our Foo count is now 10');
55 is(Bar->meta->get_count(), 1, '... our Bar count is still 1');