Also sprach
:
> Anno Siegel wrote:
>> J Krugman <> wrote in comp.lang.perl.misc:
>> >
>
> (snipped)
>
>> >
>> > What "temporary" is the error message referring to? Is there a
>> > work around?
>>
>> 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.
>
>
> Found in the perl source code:
>
> http://search.cpan.org/src/NWCLARK/perl-5.8.7/pp_hot.c
>
> It appears values on the Perl stack are being checked for
> their SvFLAGS to determine whether the subroutine is returning
> a "temporary".
The temporary here is a red-herring, I think. Some time ago I was making
a patch that would allow perl to assign plain GLOBs to tied scalars
which was eventually applied. I remember I had a hard time understanding
the mechanisms behind tying and so I put them down for later reference
at <http://use.perl.org/~ethan/journal/16385>.
The problem with tying and lvalue functions is that both require to
return a special kind of Perl scalar, namely an SvPVLV. This happens to
be a temporary because it is no longer needed after the actual
assignment happens.
However, if you try to assign to a tied-scalar via an lvalue-function,
you're in big trouble because now you have two PVLV-scalars that somehow
have to be crammed into one.
I could be wrong here, though, because perl might be smart enough to
notice that only one of these two lvalue-scalars is needed (namely the
one belonging to the tied scalar). In this case the check of temporarity
you mentioned above could be extended to also check for tiedness of the
variable in which case a temporary might be ok.
There'd only need to be some provisions that this temporary is not
destroyed too early (that is: not before the deferred assignment
happens).
Tassilo
--
use bigint;
$n=71423350343770280161397026330337371139054411854 220053437565440;
$m=-8,;;$_=$n&(0xff)<<$m,,$_>>=$m,,print+chr,,while(($ m+=

<=200);