Skip Menu |

This queue is for tickets about the Syntax-Keyword-Dynamically CPAN distribution.

Report information
The Basics
Id: 131738
Status: patched
Priority: 0/
Queue: Syntax-Keyword-Dynamically

Owner: Nobody in particular
Requestors: leonerd-cpan [...]

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

Subject: dynamically $href->{newkey} doesn't delete on restore
Download (untitled) / with headers
text/plain 198b
$ perl -Mblib -MSyntax::Keyword::Dynamically -MData::Dump=pp -E ' my $href; { dynamically $href->{newkey} = "value" } say pp($href); ' { newkey => undef } Expected output {} -- Paul Evans
Download (untitled) / with headers
text/plain 814b
Initial thoughts on this are that it's nontrivial. The current implementation simply adjusts the optree of an OP_SASSIGN to insert the internal custom op called pp_startdyn just after the LHS has been fetched as an SV, before it is assigned to. That simply saves the value, allowing it to be restored later. But by this time we've forgotten if it was an element of a hash and if so whether the element existed before we started. In perl core's case of `local $hash{key} = ...` the local'isation part is performed by pp_helem itself in the presence of the OPpLVAL_INTRO flag so it can do something special. A fix for this issue would have to take place at or around the time of the pp_helem op that forms the LHS of the assignment so it can know of the presence or absence of the key beforehand. -- Paul Evans
Download (untitled) / with headers
text/plain 203b
Another awkward case is my $h; { dynamically $h->{key} = "val"; delete $h->{key} } afterwards we have to put the key back in, because the SV itself has been removed in the meantime -- Paul Evans
An attempt at solving this one. -- Paul Evans
Subject: rt131738.patch
Download rt131738.patch
text/x-diff 11.7k

Message body is not shown because it is too large.

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to