Unlike the solution using state the my in an enclosing block allows you to include controlled access to the cache.
{ my $_cache; sub withLongComputation { $_cache //= ...; ... } sub clearCache { undef $_cache; } }
Jenda
Enoch was right!
Enjoy the last years of Rome.
In reply to Re^5: 'state' variables and unit testing (intentional)
by Jenda
in thread 'state' variables and unit testing
by vsespb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |