On Thu, Feb 24, 2011 at 6:16 AM, Jan Dubois <jand@activestate.com> wrote:
> On Wed, 23 Feb 2011, Leon Timmermans wrote:
> But how would you trigger the call to LOCALIZE?
>
> I don't want
>
> local $_;
>
> to call LOCALIZE on the existing value of $_. I expect it
> to put the existing value on the savestack and leave $_ with
> a new SV, and I expect the old value to be automatically
> restored when execution leaves the current scope.
>
> So how would LOCALIZE come into play? Would that be triggered
> by a new builtin, e.g.
I mean that local would do the equivalent of
tied($foo)->LOCALIZE($new_variable) if tied($foo) &&
tied($foo)->can('LOCALIZE');
That way we could fix this bug yet and also allow us to unbreak
File::chdir by adding such a LOCALIZE method. There's a svt_local slot
in the magic vtable specially for this kind of scenario. it shouldn't
be too hard to implement. Or am I overseeing something in this jungle
of magic and indirection?
Leon
Thread Previous
|
Thread Next