Skip Menu |

This queue is for tickets about the PadWalker CPAN distribution.

Report information
The Basics
Id: 92269
Status: rejected
Priority: 0/
Queue: PadWalker

People
Owner: robin [...] cpan.org
Requestors: ribasushi [...] leporine.io
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: closed_over has a strange return in list context
The following oneliner produces some rather bizarre output: ~$ perl -MData::Dumper -MPadWalker=closed_over -e 'my $x = {}; my $y = []; warn Dumper closed_over sub { my $n = {%$x}; my $m = {%$y} }' $VAR1 = { '$y' => \[], '$x' => \{} }; $VAR2 = { '2' => $VAR1->{'$x'}, '5' => $VAR1->{'$y'} }; The second return value is not documented, and looks rather unintentional. Perhaps a sign of a deeper memory-oddness bug? Cheers
Subject: Re: [rt.cpan.org #92269] closed_over has a strange return in list context
Date: Sun, 19 Jan 2014 23:44:18 +0000
To: bug-PadWalker [...] rt.cpan.org
From: Robin Houston <robin.houston [...] gmail.com>
Hi Peter. How interesting that you’ve stumbled across this. It’s something I haven’t thought about for a long time! This is actually an undocumented feature, and is quite intentional. I guess you didn’t look at the source code for the closed_over function, because it’s fairly obvious there that the code is deliberately returning two hashes when called in list context. Another clue is that the Changes file has a 2005 reference to “the sekrit undocumented second return value of closed_over”. :-) I wish I could remember the precise circumstances under which I added it. I’m sure it was in response to a user requirement that was impossible to meet otherwise. It is just the same as the primary return value, but the keys are the slot number in the PAD rather than the variable name. I am sure this is useful for something, though I can’t remember what. I have a vague feeling another CPAN module is using it. All the best, Robin