SPUG:Resetting a closure's memory

Jay Gray jaygray at scn.org
Mon Feb 24 14:44:32 CST 2003


Sanford,

Another trick you could try is to 'eval' the closure each time. When you
want to reset the variables, you could re-run the eval. Depending on what
you are intending for the subroutine, you could chose either method
over the other for re-initializing the subroutine's vars.

--
Jay Gray


On Sun, 23 Feb 2003, Sanford Morton wrote:

> It just occurred to me that you could also use an auxilary subroutine that
> shares the same memory:
> 
>  ( my $private = undef;
>    sub aSub {  ....  }
>    sub aSubReset { $private = undef; }
>  }
> 
> 
> _____________________________________________________________
> Seattle Perl Users Group Mailing List  
> POST TO: spug-list at mail.pm.org
> ACCOUNT CONFIG: http://mail.pm.org/mailman/listinfo/spug-list
> MEETINGS: 3rd Tuesdays, U-District, Seattle WA
> WEB PAGE: www.seattleperl.org
> 
> 




More information about the spug-list mailing list