fixing the destructor, so it wont be created unless needed
Stevan Little [Wed, 28 May 2008 03:24:55 +0000 (03:24 +0000)]
lib/Class/MOP/Package.pm

index 8edf5a7..3059d56 100644 (file)
@@ -89,9 +89,11 @@ sub add_package_symbol {
 
     my ($name, $sigil, $type) = $self->_deconstruct_variable_name($variable); 
 
+    my $pkg = $self->{'$!package'};
+
     no strict 'refs';
     no warnings 'redefine', 'misc';    
-    *{$self->{'$!package'} . '::' . $name} = ref $initial_value ? $initial_value : \$initial_value;      
+    *{$pkg . '::' . $name} = ref $initial_value ? $initial_value : \$initial_value;      
 }
 
 sub remove_package_glob {