Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: API rate limit using Cache::Mmap need helpby jcb (Parson) |
on Jul 27, 2020 at 03:00 UTC ( [id://11119855]=note: print w/replies, xml ) | Need Help?? |
While I am unfamiliar with Cache::Mmap, your error suggests that it is using Storable internally. You are trying to store a simple value, but Storable only works with references. Try changing your code like so: (untested)
Note the change: the values stored in the cache are now hashrefs. You could also use scalar references, reading them with $$val1 and incrementing with ${$val1}++. Lastly, your code as written will not compile under strict. While it would not have caught this issue, good practice is to always use strict; and use warnings;.
In Section
Seekers of Perl Wisdom
|
|