diff options
author | Jesse Luehrs <doy@tozt.net> | 2010-11-11 19:43:04 -0600 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2010-11-11 19:43:04 -0600 |
commit | 25c87f5c26ea1057a28acd82fc734aad9c4360dd (patch) | |
tree | 5dca90fa9a72eed9d8cbc0dfb4623bbae70d17a3 /lib/Package/Stash.pm | |
parent | dc378b60e595186cddf0b2ce35da3e6749022770 (diff) | |
download | package-stash-25c87f5c26ea1057a28acd82fc734aad9c4360dd.tar.gz package-stash-25c87f5c26ea1057a28acd82fc734aad9c4360dd.zip |
fix some edge cases
Diffstat (limited to 'lib/Package/Stash.pm')
-rw-r--r-- | lib/Package/Stash.pm | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/Package/Stash.pm b/lib/Package/Stash.pm index 6c361c1..88f921e 100644 --- a/lib/Package/Stash.pm +++ b/lib/Package/Stash.pm @@ -204,12 +204,7 @@ sub has_package_symbol { my $entry_ref = \$namespace->{$name}; if (reftype($entry_ref) eq 'GLOB') { - if ( $type eq 'SCALAR' ) { - return defined ${ *{$entry_ref}{SCALAR} }; - } - else { - return defined *{$entry_ref}{$type}; - } + return defined *{$entry_ref}{$type}; } else { # a symbol table entry can be -1 (stub), string (stub with prototype), @@ -392,10 +387,10 @@ sub list_all_package_symbols { # type (SCALAR|ARRAY|HASH|CODE) if ($type_filter eq 'CODE') { return grep { - (ref($namespace->{$_}) - ? (ref($namespace->{$_}) eq 'SCALAR') - : (ref(\$namespace->{$_}) eq 'GLOB' - && defined(*{$namespace->{$_}}{CODE}))); + # any non-typeglob in the symbol table is a constant or stub + ref(\$namespace->{$_}) ne 'GLOB' + # regular subs are stored in the CODE slot of the typeglob + || defined(*{$namespace->{$_}}{CODE}); } keys %{$namespace}; } else { return grep { *{$namespace->{$_}}{$type_filter} } keys %{$namespace}; |