Skip Menu |

This queue is for tickets about the Tie-Proxy-Hash CPAN distribution.

Report information
The Basics
Id: 44850
Status: new
Priority: 0/
Queue: Tie-Proxy-Hash

People
Owner: Nobody in particular
Requestors: dmuey [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: feature request: prepend_hash()
Hello, I was very happy to come across your module! It'd be nice to have a way to add a has to the beginning of the stack in addition adding one to the end. i.e. prepend_hash() would be like add_hash() but add the hash to the beginning of the stack. That way we can load up "global defaults" as the only hash. then on an as needed basis, prepend a smaller hash of overrides before it. e.g. .... initialize .... my $hash_tie_ref = tie my %hash, 'Tie::Proxy::Hash', ('main_defaults' => { 'notify' => 0, 'verbose' => 0, }); .... start a given context, a request of some sort .... $hash{'verbose'} is '0' $hash_tie_ref->prepend_hash('context_values', { 'verbose' => 1,}); .... do work in this context .... $hash{'verbose'} is '1' $hash_tie_ref->remove_hash('context_values'); ... $hash{'verbose'} is '0' again I'd be happy to do the work (and maybe modernize the code a bit) if you'd like to make me co-maintainer via pause. my cpan id is dmuey. no worries if not, it'd just be nice to have prepend_hash() ;p thanks!