Posted on 2008-03-05 22:22:09-08 by random in response to 7257
Re: Defining optional hash keys
I deployed your proposed workaround and it works great so far (performance is not a real issue for testing in my case. I'm using this sub (typos corrected):
sub opthash { my ($must_have, $can_have) = @_; return all(superhashof($must_have), subhashof({ %$must_have, %$can_have }) ); }
Would it make sense to add this to Test::Deep directly and add the pod for it stating that it is not optimized and should not be used on large hashes where performance is mandatory? Cheers
Direct Responses: 7291 | Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.