[A complimentary Cc of this posting was sent to
Anno Siegel
It looks like "temporary" refers to the state of a scalar of being
"mortal". Mortal SVs are all over the Perl source, but normally
only concern XS programmers. This is the first time I see the
distinction appear at Perl level.
There is no way to determine that a thing is mortal (short of walking
up the mortalization stack and checking whether a value is there).
So, obviously, it is not that. Here "a temporary" is an intermediate
variable created by Perl without a direct intervention of a programmer.
I'm afraid that it was me who put this error message there; so all the
blame on its wording may be on me. When I introduced the lvalue subs,
there was a lot of suspicion on p5p that the whole idea is junk; as a
result, the handling is over-protecting. This "can't" in the message,
for example, is red herring; there would be no problem for Perl to
change a value of a temporary; it is just that usually it is not what
a programmer wants:
sub add5 : lvalue {
my $x = shift;
return $x + 5;
}
So the main usage of this message is to warn the programmer of
*possibly* flaky code.
The problem is that the current implementation of tied hashes is using
a temporary to handle access to a value for a key. I did not realize
this when implementing the lvalue subs, so there is no special case to
handle this "legitimate" use of temporaries in lvalue subs.
Hope this helps,
Ilya