in reply to Re^10: sub fuction inside sub functioin?
in thread sub fuction inside sub functioin?

Are you talking about the original lexical code (sub outer { my $inner; ... }) or the updated one ({ my $inner; sub outer { ... } }). I sent you a message a few posts ago that I updated my post to retract my comment.

Replies are listed 'Best First'.
Re^12: sub fuction inside sub functioin?
by LanX (Saint) on Dec 08, 2008 at 14:16 UTC
    I was talking about
    { my $inner; sub outer { $inner=sub { ... $inner->(); ... } } }.
    OK I just saw your update. IMHO this is the safest way to realize inner subs without stash side-effects and cyclic memory leaks.

    To get back to the OT, I recommend it this way.

    Cheers Rolf

      To get back to the OT, I recommend it this way.

      To get back to the OT, I stick with my original recommendation. I had already considered the alternatives before posting it and found them to leak memory and/or needlessly convoluted.

      Reader, take your pick. If you bless a hash to make an object, you have no reason to use lexicals for inner subs.