The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Hash::Typed - Ordered typed tied hashes.

VERSION

Version 0.05

SYNOPSIS

        use Hash::Types;

        use Types::Standard qw/Int Str ArrayRef/;

        my $test = Hash::Typed->new(
                [
                        strict => 1,
                        required => 1, # all keys are required on instantiation
                        keys => [
                                one => Int,
                                two => Str,
                                three => ArrayRef,
                                four => sub { return 1 },
                                five => sub { 
                                        Hash::Typed->new(
                                                [ strict => 1, required => [qw/one/], keys => [ one => Int ] ],
                                                %{$_[0]}
                                        );
                                }
                        ]
                ],
                (
                        three => [qw/a b c/],
                        two => 'def',
                        one => 211,
                        four => undef,
                        five => { one => 633 }
                )
        );

        $test->{one} = "not okay";  # errors as does not pass Int type constraint.

        ...

        tie my %test, 'Hash::Typed',
                [
                        strict => 1,
                        required => [qw/one two three four/],
                        keys => [
                                one => Int,
                                two => Str,
                                three => ArrayRef,
                                four => sub { return 1 },
                                five => sub { Hash::Typed->new(@{$_[0]}); }
                        ]
                ],
                (
                        three => [qw/a b c/],
                        two => 'def',
                        one => 211,
                        four => undef,
                        five => [ [keys => [ one => Int ]], one => 633 ]
                );

...

        {
                one => 211, 
                two => 'def', 
                three => [qw/a b c/], 
                four => 1, 
                five => { 
                        one => 633 
                }
        }

SUBROUTINES/METHODS

AUTHOR

LNATION, <email at lnation.org>

BUGS

Please report any bugs or feature requests to bug-hash-typed at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Hash-Typed. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

        perldoc Hash::Typed

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is Copyright (c) 2022 by LNATION.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)