From 7d36752dfb8434954e17524a0f6a5fb68352c1eb Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 10 Jul 2012 17:44:47 -0500 Subject: vivify globs properly, so they pick up the right magic --- lib/Package/Stash/PP.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib/Package/Stash/PP.pm') diff --git a/lib/Package/Stash/PP.pm b/lib/Package/Stash/PP.pm index a831564..49cce98 100644 --- a/lib/Package/Stash/PP.pm +++ b/lib/Package/Stash/PP.pm @@ -182,7 +182,15 @@ sub add_symbol { } else { my $namespace = $self->namespace; - $namespace->{$name} ||= *{ Symbol::gensym() }; + { + # using glob aliasing instead of Symbol::gensym, because otherwise, + # magic doesn't get applied properly. + # see <20120710063744.19360.qmail@lists-nntp.develooper.com> on p5p + local *__ANON__:: = $namespace; + no strict 'refs'; + no warnings 'void'; + *{"__ANON__::$name"}; + } if (@_ > 2) { no warnings 'redefine'; -- cgit v1.2.3-54-g00ecf