diff options
author | Jesse Luehrs <doy@tozt.net> | 2010-11-11 20:09:58 -0600 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2010-11-11 20:09:58 -0600 |
commit | f75437398a7a18f7852b0151f7cb808dbeb06d0a (patch) | |
tree | 123bfbe91697dc7b1aba63ce4233c3aebd6f1f2d /lib | |
parent | 25c87f5c26ea1057a28acd82fc734aad9c4360dd (diff) | |
download | package-stash-xs-f75437398a7a18f7852b0151f7cb808dbeb06d0a.tar.gz package-stash-xs-f75437398a7a18f7852b0151f7cb808dbeb06d0a.zip |
preserve existing behavior here i guess
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Package/Stash.pm | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Package/Stash.pm b/lib/Package/Stash.pm index 88f921e..132f687 100644 --- a/lib/Package/Stash.pm +++ b/lib/Package/Stash.pm @@ -204,7 +204,16 @@ sub has_package_symbol { my $entry_ref = \$namespace->{$name}; if (reftype($entry_ref) eq 'GLOB') { - return defined *{$entry_ref}{$type}; + # XXX: assigning to any typeglob slot also initializes the SCALAR slot, + # and saying that an undef scalar variable doesn't exist is probably + # vaguely less surprising than a scalar variable popping into existence + # without anyone defining it + if ($type eq 'SCALAR') { + return defined ${ *{$entry_ref}{$type} }; + } + else { + return defined *{$entry_ref}{$type}; + } } else { # a symbol table entry can be -1 (stub), string (stub with prototype), |