Types::...rd::Map(3)

πŸ’… Types::...rd::Map(3) β€” like, the actual manual page, bestie

okay so real talk, this is Types::...rd::Map(3) from the User Contributed Perl Documentation and it's here to explain Types::Standard::Map to you. grab a boba, we're doing this 🌸


✨ NAME ✨

Types::Standard::Map β€” an exporter utility for the Map type constraint. that's the whole vibe πŸŽ€


🌈 SYNOPSIS 🌈

like, the normal way to validate a map:

use Types::Standard -types;

# Normal way to validate map.
#
Map->of( Int, Str )->assert_valid( { 1 => "one" } );

use Types::Standard::Map IntsToStrs => { keys => Int, values => Str },

# Exported shortcut
#
assert_IntsToStrs { 1 => "one" };

(no, we did not "fix" that trailing comma β€” it's character for character what the page says, iykyk 😌)


⚑ STATUS ⚑

not covered by the Type-Tiny stability policy, so like... it's giving experimental. act accordingly 🫢


πŸ’– DESCRIPTION πŸ’–

ngl this is mostly internal code, but it also lowkey moonlights as an exporter utility. main character energy fr ✨

🧚 Exports

Types::Standard::Map can be used experimentally as an exporter. periodt.

use Types::Standard 'Int';
use Types::Standard::Map IntsToStrs => { keys => Int, values => Str },

this will export the following functions into your namespace, slay:

  • "IntsToStrs"
  • is_IntsToStrs( $value )
  • assert_IntsToStrs( $value )
  • to_IntsToStrs( $value )

and bestie, you can export multiple types at once β€” obsessed:

use Types::Standard -types;
use Types::Standard::Map (
  IntsToStrs  => { keys => Int, values => Str },
  StrsToInts  => { keys => Str, values => Int },
);

assert_StrsToInts { two => 2 };   # should not die

it's also possible to further constrain the hashref using "where" πŸ‘‘

use Types::Standard::Dict MyThing => {
  keys   => Str->where( sub { ... } ),
  values => Int->where( sub { ... } ),
  where  => sub { ... },
};

πŸ’€ BUGS πŸ’€

found a bug? please report any bugs to <https://github.com/tobyink/p5-type-tiny/issues> πŸ› and be nice about it πŸ’œ


πŸ‘€ SEE ALSO πŸ‘€

  • Types::Standard β€” the icon itself ⭐

🫢 AUTHOR 🫢

Toby Inkster <tobyink@cpan.org> πŸ’–


this software is copyright (c) 2013-2025 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. free as in, go off πŸ’…


πŸ™ˆ DISCLAIMER OF WARRANTIES πŸ™ˆ

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.

like, no promises, bestie, that's the deal 😭 read it, it's literally all caps for a reason.


and that's the whole page!! brought to you by perl v5.42.2 dated 2026-04-07, signing off β€” Types::...rd::Map(3) out πŸ’œπŸ¦‹βœ¨

πŸ“¦ where this page comes from