Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: User preference: To store params or not

by jeffa (Bishop)
on Jul 28, 2015 at 22:46 UTC ( [id://1136672]=note: print w/replies, xml ) Need Help??


in reply to User preference: To store params or not

I think i would have the defaults in a temporary hash and merge that with the users preferences:

my %default = ( foo => 1, bar => 2); my %users = ( bar =>3 , baz => 2 ); my %CONFIG = ( %default, %users ); # user overrides default

This way you shouldn't have to reset them, they get applied "on the fly."

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re^2: User preference: To store params or not
by stevieb (Canon) on Jul 28, 2015 at 23:09 UTC

    Thanks jeffa. I'm trying to implement a cache for data, and it requires past params to be known. I'm seriously considering writing a is_deeply type filter for Memoize to do this work so I don't have to.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1136672]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2024-04-26 00:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found