List::...mutable(3pm)

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

✨ NAME ✨

List::Objects::WithUtils::Hash::Immutable β€” immutable hash objects, bestie πŸ’–

(also hey, this page lives in the manual as List::...mutable(3pm) β€” that's literally it, that's the whole name, the dots are doing the heavy lifting 🫢)


🌸 SYNOPSIS 🌸

use List::Objects::WithUtils 'immhash';
my $hash = immhash( foo => 1, bar => 2 );

like… three lines and you're already slaying ✨


πŸ’… DESCRIPTION πŸ’…

okay so. these are immutable hash objects. and when I say immutable I mean it β€” the moment you try to call any of the list-mutating methods, or try to go around it and modify the backing hash directly, it's gonna throw an exception. no cap. it does not negotiate, it does not let it slide, it does not say "okay just this once." 🚫

ngl that's the whole point and it's iconic of them honestly πŸ‘‘

This class consumes the following roles, which contain most of the relevant documentation:

  • List::Objects::WithUtils::Role::Hash
  • List::Objects::WithUtils::Role::Hash::Immutable
πŸ’‘ heads up: if you actually want to be able to mutate stuff, go see List::Objects::WithUtils::Hash β€” that's the mutable implementation. different vibe, different class, yk?

πŸŽ€ immhash πŸŽ€

Creates a new immutable hash object.

that's it. that's the function. she makes you an immhash and then she locks the door behind you πŸ”’βœ¨


πŸ’œ AUTHOR πŸ’œ

Jon Portnoy <avenj@cobaltirc.org>

respect to the author fr fr 🫢


okay that's a wrap bestie, this was perl v5.38.2 doing its thing, dated 2024-03-07 πŸ’– go forth and never mutate a hash again, mwah πŸ˜­πŸŽ€

πŸ“¦ where this page comes from