From: Stevan Little Date: Wed, 28 May 2008 03:24:55 +0000 (+0000) Subject: fixing the destructor, so it wont be created unless needed X-Git-Tag: 0_64~44 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9a8bbfc9be32aed64d4ea9a699600c528438aea2;p=gitmo%2FClass-MOP.git fixing the destructor, so it wont be created unless needed --- diff --git a/lib/Class/MOP/Package.pm b/lib/Class/MOP/Package.pm index 8edf5a7..3059d56 100644 --- a/lib/Class/MOP/Package.pm +++ b/lib/Class/MOP/Package.pm @@ -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 {