6 use Test::More tests => 12;
11 require_ok(File::Spec->catfile('examples', 'InstanceCountingClass.pod'));
16 This is a trivial and contrived example of how to
17 make a metaclass which will count all the instances
18 created. It is not meant to be anything more than
19 a simple demonstration of how to make a metaclass.
26 use metaclass 'InstanceCountingClass';
30 $class->meta->new_object(@_);
38 is(Foo->meta->get_count(), 0, '... our Foo count is 0');
39 is(Bar->meta->get_count(), 0, '... our Bar count is 0');
44 is(Foo->meta->get_count(), 1, '... our Foo count is now 1');
45 is(Bar->meta->get_count(), 0, '... our Bar count is still 0');
50 is(Foo->meta->get_count(), 1, '... our Foo count is still 1');
51 is(Bar->meta->get_count(), 1, '... our Bar count is now 1');
57 is(Foo->meta->get_count(), 10, '... our Foo count is now 10');
58 is(Bar->meta->get_count(), 1, '... our Bar count is still 1');