only pass initializers for array and hash
Jesse Luehrs [Wed, 12 May 2010 05:35:25 +0000 (00:35 -0500)]
lib/Stash/Manip.pm

index 3055d1d..173ba13 100644 (file)
@@ -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};