[Israel.pm] Exporting a Memoized function

Shmuel Fomberg shmuelfomberg at gmail.com
Thu Jun 27 06:40:54 PDT 2013


On Thu, Jun 27, 2013 at 8:26 PM, Gaal Yahas wrote:

> Wouldn't putting the call to memoize in a BEGIN block do the trick?
>

Ah, it will. But I want to expose the ability of tying the cache to a
permanent storage (such as DB_File)  in production or not to, in testing
mode.

Which brings me to a new question: I connect the memorized function to a
hashref that points to a tied hash that is tied to DB_File.
Can I tie the hash afterwards? I think that I can.
This will solve my memorize problem (that I already solved using one more
function call) and will let me init the the permanent storage on run time.
I like it.

Shmuel.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.perl.org.il/pipermail/perl/attachments/20130627/cfc6ee9a/attachment.htm 


More information about the Perl mailing list