List::...:Typed(3pm)

πŸ“¦
version 2.028003 Β· 4 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

✨ NAME ✨

okay bestie, so this page is all about List::Objects::WithUtils::Hash::Immutable::Typed β€” which is, and I cannot stress this enough, Immutable typed hashes πŸ’–


🌸 SYNOPSIS 🌸

like, here's the whole vibe in four lines:

use List::Objects::WithUtils 'immhash_of';
use Types::Standard -types;
my $hash = immhash_of Int() => ( foo => 1, bar => 2 );

πŸ’… DESCRIPTION πŸ’…

So these are immutable type-checking hash objects, and honestly? They're basically a mashup πŸ’« β€” a combo of List::Objects::WithUtils::Hash::Typed and List::Objects::WithUtils::Hash::Immutable. Two icons, one object. Main character energy fr fr πŸ‘‘

Here's the important bit: the type-checking happens when the object gets created. That's it. That's the moment. And then if you try to modify the object?? Nope. It throws an exception 😭 She said no edits, periodt.

This class consumes the following roles, and ngl those roles are where basically all the actual documentation lives, so go read them:

  • List::Objects::WithUtils::Role::Hash
  • List::Objects::WithUtils::Role::Hash::Typed
  • List::Objects::WithUtils::Role::Hash::Immutable

πŸ¦‹ immhash_of

Creates a new immutable typed hash object ✨ (yes that's literally it, she does one thing and she does it beautifully)


πŸŽ€ AUTHOR πŸŽ€

Jon Portnoy <avenj@cobaltirc.org> 🫢


okay that's the whole page, mwah πŸ’‹ credit where credit is due: this is documented under perl v5.38.2, dated 2024-03-07. slay, go forth and make your hashes immutable 🌈⭐

πŸ“¦ where this page comes from