in reply to Re^2: 'state' variables and unit testing
in thread 'state' variables and unit testing
If you use a global for the caching you are doing it wrong. You allow anyone, anywhere to change the cached value. The right way before state was
{ my $_cached; sub whatever { $_cached //= ... } }
Jenda
Enoch was right!
Enjoy the last years of Rome.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: 'state' variables and unit testing (intentional)
by tye (Sage) on Feb 02, 2014 at 02:27 UTC | |
by Jenda (Abbot) on Feb 02, 2014 at 12:10 UTC | |
by tobyink (Canon) on Feb 04, 2014 at 13:08 UTC |