From: Jesse Luehrs Date: Wed, 12 May 2010 05:35:25 +0000 (-0500) Subject: only pass initializers for array and hash X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a2a2164aadab29b7424ea8f581413cf6a3b185b1;p=gitmo%2FPackage-Stash-PP.git only pass initializers for array and hash --- diff --git a/lib/Stash/Manip.pm b/lib/Stash/Manip.pm index 3055d1d..173ba13 100644 --- a/lib/Stash/Manip.pm +++ b/lib/Stash/Manip.pm @@ -204,12 +204,17 @@ sub get_package_symbol { my $namespace = $self->namespace; - # FIXME if (!exists $namespace->{$name}) { - my $initial = $type eq 'ARRAY' ? [] - : $type eq 'HASH' ? {} - : \undef; - $self->add_package_symbol($variable, $initial) + if ($type eq 'ARRAY') { + $self->add_package_symbol($variable, []); + } + elsif ($type eq 'HASH') { + $self->add_package_symbol($variable, {}); + } + else { + # FIXME + $self->add_package_symbol($variable) + } } my $entry_ref = \$namespace->{$name};