in reply to Re^4: localizing lexical without messing with tie ?
in thread localizing lexical without messing with tie ?

see Re^2: localizing lexical without messing with tie ?.

What do you call "passed variable"?

As I said, an additional local untie does what I wanted.

Doubtful. The untie isn't local. I've provided a solution that works where you used untie.

Replies are listed 'Best First'.
Re^6: localizing lexical without messing with tie ?
by LanX (Saint) on Sep 09, 2010 at 11:31 UTC
    > What do you call "passed variable"?

    sub tst (&$) { $_[1]++; # passed variable $_[0]->(); # passed block } tst { print $c} $c;

    Cheers Rolf

      So "override a global lexical variable for a dynamic scope", where you have access to the global via an alias.

      Could you use $_, $a and $b or arguments instead?

      I don't see how PadWalker would help. If you found a solution using it, it might be possible to recreate the solution using B (a core module).

        > Could you use $_, $a and $b or arguments instead?

        no, it's intended to allow an unlimited number of vars, and as a side note $a and $b could be tied too.

        As I said, forbidding tied vars is a good and pragmatic solution to get around this edge case.

        Cheers Rolf