- SEE ALSO
- COPYRIGHT AND LICENCE
- DISCLAIMER OF WARRANTIES
Types::ReadOnly - type constraints and coercions for read-only data structures and locked hashes
has foo => (is => 'ro', isa => ReadOnly[ArrayRef], coerce => 1);
This is a type constraint library for write-restricted references.
This library provides the following type constraints:
A type constraint for references to read-only scalars, arrays and hashes. Values don't necessarily need to be deeply read-only to pass the type check.
This type constraint inherits coercions from its parameter, and makes the result read-only (deeply).
A type constraint for hashrefs with locked keys (see Hash::Util).
This type constraint only works when it is parameterized with
HashRefor a hashref-like type constraint. For example
Locked[ Map[ IpAddr, HostName ] ].
When parameterized with a
Dicttype constraint (see Types::Standard), it will use the
Dicttype as the authoritative list of keys that the hashref should be locked with, unless the Dict includes a slurpy parameter (e.g.
Dict[foo => Int, slurpy HashRef[Num]]).
This type constraint inherits coercions from its parameter, and applies
lock_ref_keysto the result.
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Types-ReadOnly.
Toby Inkster <email@example.com>.
This software is copyright (c) 2013, 2019 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.