Dear Monks,
I got a module which handles caching of various items. Items may be changed far away from the module actually filling the cache and I want to provide a way for scripts to force cache refreshing even if the source actually getting/setting the data is another file.
My idea was a global
our $FORCE_REFRESH = 0;in my Cache module which should be set to 1 to force all subsequent read's to fail and refresh the cache this way:
{ local $My::Cache::FORCE_REFRESH=1; &some_sub_requesting_the_data; }
I want My::Cache to complain (and refuse to force refreshing) if someone starts modifying the variable without using local.
I don't want a My::Cache::set_force_refresh() function because I'm pretty sure people will set it without resetting it as soon as possible.
Is there any way to detect if a variable is currently localized?
Thanks,
Sebastian
In reply to Detect a localized variable by Sewi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |