Help language development. Donate to The Perl Foundation
Hash::Restricted - trait for restricting keys in hashes
use Hash::Restricted; my %h is restricted = a => 42, b => 666; %h<c> = 317; # dies my %h is restricted<a b>; %h<a> = 42; %h<b> = 666; %h<c> = 317; # dies
Hash::Restricted provides a
is restricted trait on
Hashes as an easy way to restrict which keys are going to be allowed in the
If you do not specify any keys with
is restricted, it will limit to the keys that were specified when the
Hash was initialized.
If you do specify keys, then those will be the keys that will be allowed.
Elizabeth Mattijsen [email protected]
Source can be located at: https://github.com/lizmat/Hash-Restricted . Comments and Pull Requests are welcome.
Copyright 2018 Elizabeth Mattijsen
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.