docs for weaken
[gitmo/Class-MOP.git] / lib / Class / MOP / Class.pm
index 38b11f9..6648927 100644 (file)
@@ -1478,6 +1478,21 @@ Specifies the name to install the C<meta> method for this class under.
 If it is not passed, C<meta> is assumed, and if C<undef> is explicitly
 given, no meta method will be installed.
 
+=item * weaken
+
+If true, the metaclass that is stored in the global cache will be a
+weak reference.
+
+Classes created in this way are destroyed once the metaclass they are
+attached to goes out of scope, and will be removed from Perl's internal
+symbol table.
+
+All instances of a class with a weakened metaclass keep a special
+reference to the metaclass object, which prevents the metaclass from
+going out of scope while any instances exist.
+
+This only works if the instance is based on a hash reference, however.
+
 =back
 
 =item B<< Class::MOP::Class->create_anon_class(%options) >>
@@ -1489,15 +1504,8 @@ that name is a unique name generated internally by this module.
 It accepts the same C<superclasses>, C<methods>, and C<attributes>
 parameters that C<create> accepts.
 
-Anonymous classes are destroyed once the metaclass they are attached
-to goes out of scope, and will be removed from Perl's internal symbol
-table.
-
-All instances of an anonymous class keep a special reference to the
-metaclass object, which prevents the metaclass from going out of scope
-while any instances exist.
-
-This only works if the instance is based on a hash reference, however.
+Anonymous classes default to C<< weaken => 1 >>, although this can be
+overridden.
 
 =item B<< Class::MOP::Class->initialize($package_name, %options) >>