X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=examples%2FInstanceCountingClass.pod;h=d6a4f318e9c58e3c954eeccaf47c8744bde7b1f5;hb=7202116b012d65b1c71d42819a0d2aa2ec5d3bd1;hp=da8003802dcd477303f00ac6b6c083dd3869289a;hpb=550d56db72e2f36b7fb88e6f9aa9d7f3d3fef53b;p=gitmo%2FClass-MOP.git diff --git a/examples/InstanceCountingClass.pod b/examples/InstanceCountingClass.pod index da80038..d6a4f31 100644 --- a/examples/InstanceCountingClass.pod +++ b/examples/InstanceCountingClass.pod @@ -5,7 +5,7 @@ package # hide the package from PAUSE use strict; use warnings; -our $VERSION = '0.02'; +our $VERSION = '0.03'; use base 'Class::MOP::Class'; @@ -14,11 +14,10 @@ InstanceCountingClass->meta->add_attribute('$:count' => ( default => 0 )); -sub construct_instance { - my ($class, %params) = @_; - $class->{'$:count'}++; - return $class->SUPER::construct_instance(%params); -} +InstanceCountingClass->meta->add_before_method_modifier('construct_instance' => sub { + my ($class) = @_; + $class->{'$:count'}++; +}); 1; @@ -56,13 +55,15 @@ InstanceCountingClass - An example metaclass which counts instances This is a classic example of a metaclass which keeps a count of each instance which is created. -=head1 AUTHOR +=head1 AUTHORS Stevan Little Estevan@iinteractive.comE +Yuval Kogman Enothingmuch@woobling.comE + =head1 COPYRIGHT AND LICENSE -Copyright 2006 by Infinity Interactive, Inc. +Copyright 2006-2008 by Infinity Interactive, Inc. L