From: Stevan Little Date: Thu, 4 May 2006 03:46:40 +0000 (+0000) Subject: re-init X-Git-Tag: 0_29_02~14 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ff43b9d6acdcea4c3e956535cca49bee4d1390b5;p=gitmo%2FClass-MOP.git re-init --- diff --git a/lib/Class/MOP/Class.pm b/lib/Class/MOP/Class.pm index 1b4580f..8fa015d 100644 --- a/lib/Class/MOP/Class.pm +++ b/lib/Class/MOP/Class.pm @@ -40,6 +40,15 @@ sub meta { Class::MOP::Class->initialize(blessed($_[0]) || $_[0]) } $class->construct_class_instance(':package' => $package_name, @_); } + sub reinitialize { + my $class = shift; + my $package_name = shift; + (defined $package_name && $package_name && !blessed($package_name)) + || confess "You must pass a package name and it cannot be blessed"; + $METAS{$package_name} = undef; + $class->construct_class_instance(':package' => $package_name, @_); + } + # NOTE: (meta-circularity) # this is a special form of &construct_instance # (see below), which is used to construct class