On fredag, augusti 9, 2002, at 10:12 , Elizabeth Mattijsen wrote:
>
> Shared variables in this approach are truly shared. The value of a
> variable
> only exists once in memory. This implementation also circumvents the
> memory
> leak that currently (threads::shared version 0.90) plagues any shared
> array
> or shared hash access.
>
> =
You will find that this is not true :-(, mostly because of perl deals
with tieing.
Perl will always copy the result from a tied call into the variable that
is tied.
so in effect
tie $foo, "Tie";
sub Tie::FETCH {
return "hi";
}
will result in
print $foo;
not being print tied($foo)->FETCH(); but rather that it will be
$foo = tied($foo)->FETCH; print $foo;
so before every access to the tied object, FETCH is called and the
return value is copied into the tied variable which is then used as a
normal perl variable.
this is why I want to replace magic with PMC, this is also why tied
variables are 2x as slowas doing tied($foo)->FETCH directly
Arthur