setting weaken should be based on the passed in cache value
[gitmo/Moose.git] / lib / Class / MOP / Package.pm
index cca1cb6..062706f 100644 (file)
@@ -96,6 +96,7 @@ sub create {
         my ($class, %options) = @_;
 
         my $cache_ok = delete $options{cache};
+        $options{weaken} = !$cache_ok unless exists $options{weaken};
 
         my $cache_key;
         if ($cache_ok) {
@@ -109,8 +110,6 @@ sub create {
             }
         }
 
-        $options{weaken} = !$cache_ok unless exists $options{weaken};
-
         my $package_name = $class->_anon_package_prefix . ++$ANON_SERIAL;
 
         my $meta = $class->create($package_name, %options);