SPUG:Resetting a closure's memory
Sanford Morton
smorton at pobox.com
Sun Feb 23 10:50:14 CST 2003
Closures are typically used to create a private memory for a
subroutine. What's the best way to clear this memory and reset the
closure--as if the closure were being called for the first time?
All I can think of is to pass a variable to the closure asking it to
reset itself, but I was wondering if there were a more elegant way.
( my $private = undef;
sub aSub {
my $amnesia = shift;
$private = undef if $amnesia;
....
}
}
More information about the spug-list
mailing list