diff options
author | Jesse Luehrs <doy@tozt.net> | 2011-11-29 03:04:56 -0600 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2011-11-29 03:04:56 -0600 |
commit | 0f40e41f356af017fc3ff3a2c685c61ff648b4c0 (patch) | |
tree | 923ea4c567ebaa5f70e733d56609f1228ae70b6d /lib/Package/Stash/PP.pm | |
parent | c049a789b0ccb2734ee8c8f1b8a6bb80b575c19b (diff) | |
download | package-stash-0f40e41f356af017fc3ff3a2c685c61ff648b4c0.tar.gz package-stash-0f40e41f356af017fc3ff3a2c685c61ff648b4c0.zip |
don't initialize the slot unless a value is provided
Diffstat (limited to 'lib/Package/Stash/PP.pm')
-rw-r--r-- | lib/Package/Stash/PP.pm | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Package/Stash/PP.pm b/lib/Package/Stash/PP.pm index 121a57e..67e4658 100644 --- a/lib/Package/Stash/PP.pm +++ b/lib/Package/Stash/PP.pm @@ -160,8 +160,11 @@ sub add_symbol { my $namespace = $self->namespace; $namespace->{$name} ||= *{ Symbol::gensym() }; - *{ $namespace->{$name} } = ref $initial_value - ? $initial_value : \$initial_value; + + if (@_ > 2) { + *{ $namespace->{$name} } = ref $initial_value + ? $initial_value : \$initial_value; + } } sub remove_glob { |