diff options
author | Jesse Luehrs <doy@tozt.net> | 2011-11-28 16:40:50 -0600 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2011-11-28 16:40:50 -0600 |
commit | d621315953ba8906c2a5346de654298e5c70959b (patch) | |
tree | ca2a5b6b7285c3101f277ecc8fb1fa799247c8d9 | |
parent | 86cf2011e6d3db989f65c31979a00a1acf30220e (diff) | |
download | package-stash-d621315953ba8906c2a5346de654298e5c70959b.tar.gz package-stash-d621315953ba8906c2a5346de654298e5c70959b.zip |
hack in support for package::anon specifically here
would be nice to do this more generically, but can't figure out how for
now
-rw-r--r-- | lib/Package/Stash/PP.pm | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/Package/Stash/PP.pm b/lib/Package/Stash/PP.pm index f60ac4a..98b86b8 100644 --- a/lib/Package/Stash/PP.pm +++ b/lib/Package/Stash/PP.pm @@ -243,8 +243,17 @@ sub get_symbol { } else { if ($type eq 'CODE') { - no strict 'refs'; - return \&{ $self->name . '::' . $name }; + # XXX we should really be able to support arbitrary anonymous + # stashes here... (not just via Package::Anon) + if (blessed($namespace) && $namespace->isa('Package::Anon')) { + # ->can will call gv_init for us + $namespace->bless(\(my $foo))->can($name); + return *{ $namespace->{$name} }{CODE}; + } + else { + no strict 'refs'; + return \&{ $self->name . '::' . $name }; + } } else { return undef; |