From: Jesse Luehrs Date: Sun, 11 Dec 2011 02:02:27 +0000 (-0600) Subject: work around glob brokenness on pre-5.14 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9a7de0590d520b1676507850d4cd38e31ec4ab6d;p=gitmo%2FPackage-Stash-XS.git work around glob brokenness on pre-5.14 --- diff --git a/t/anon-basic.t b/t/anon-basic.t index fc26f12..2b7575c 100644 --- a/t/anon-basic.t +++ b/t/anon-basic.t @@ -272,13 +272,17 @@ like(exception { is_deeply([Package::Stash->new('Foo')->list_all_symbols], [], "Foo:: isn't touched"); +# *{ $Quux->{foo} } = \23 doesn't work on 5.12 and lower, apparently my $Quux = Package::Anon->new('Quux'); -$Quux->{foo} = *{ Symbol::gensym() }; -*{ $Quux->{foo} } = \23; -*{ $Quux->{foo} } = ["bar"]; -*{ $Quux->{foo} } = { baz => 1 }; -*{ $Quux->{foo} } = sub { }; -*{ $Quux->{foo} } = *{ Symbol::geniosym() }{IO}; +{ + my $gv = Symbol::gensym; + *$gv = \23; + *$gv = ["bar"]; + *$gv = { baz => 1 }; + *$gv = sub { }; + *$gv = *{ Symbol::geniosym() }{IO}; + $Quux->{foo} = *$gv; +} { my $stash = Package::Stash->new($Quux); @@ -329,16 +333,25 @@ is_deeply([Package::Stash->new('Quux')->list_all_symbols], [], my $Quuux = Package::Anon->new('Quuux'); -$Quuux->{foo} = *{ Symbol::gensym() }; -*{ $Quuux->{foo} } = \(my $scalar); -*{ $Quuux->{foo} } = []; +{ + my $gv = Symbol::gensym; + *$gv = \(my $scalar); + *$gv = []; + $Quuux->{foo} = *$gv; +} -$Quuux->{bar} = *{ Symbol::gensym() }; -*{ $Quuux->{bar} } = []; +{ + my $gv = Symbol::gensym; + *$gv = []; + $Quuux->{bar} = *$gv; +} -$Quuux->{baz} = *{ Symbol::gensym() }; -*{ $Quuux->{baz} } = {}; -*{ $Quuux->{baz} } = sub { }; +{ + my $gv = Symbol::gensym; + *$gv = {}; + *$gv = sub { }; + $Quuux->{baz} = *$gv; +} $Quuux->{quux} = \1;