Module:...TieHash(3)

πŸ“¦ version 1.1.3, in alpine 3.24

🌸 NAME 🌸

okay so welcome to the Module:...TieHash(3) page from User Contributed Perl Documentation β€” this is Module::Generic::TieHash, aka the generic tie hash mechanism for object oriented hashes πŸ’…βœ¨

It's literally a tied hash that's not boring, bestie. It's giving "keys can be strings or refs, and the vibe is immaculate" πŸ¦‹

✨ SYNOPSIS ✨

okay so here's the little demo, no cap:

use DateTime;
my $tie = tie( my %hash, 'Module::Generic::TieHash', { key_object => 1 } );
my $now = DateTime->now;
my $array = [];
my $ref = {};
my $scalar = \"Hello";
my $code = sub{1};
my $glob = \*main;

$hash{ $now } = 'today';
$hash{ $array } = 'an array';
$hash{ $ref } = 'an hash';
$hash{ $scalar } = 'a scalar reference';
$hash{ $code } = 'anonymous subroutine';
$hash{ $glob } = 'a filehandle';
$hash{name} = 'John Doe';

πŸ’– DESCRIPTION πŸ’–

This module implements a tied hash mechanism that accepts as keys strings or references, if the option key_object is enabled, recursively, meaning, even embedded hash references within the top hash reference are also tied to this class.

It also supports callback hooks for Storable.

The constructor TIEHASH supports the following options provided as an hash reference:

  • debug β€” the debug value as an integer.
  • disable β€” an array reference of module classes for which this package will give direct access to the tie object rather to the data stored. To avoid conflict, the object properties and the tied hash properties are stored in different parts of the tied object. By default, Module::Generic is part of the exclusion list for which this tied object is disabled.
  • key_object β€” Boolean. If true, this allows for the storing of objects as hash keys. Normally, perl would stringify an object to use it as an hash key.

Also, if you set the global variable $PAUSED, then the exclusion mechanism will be disabled, and during that time, any access to the tied hash will return data stored in it, rather than the object properties.

⭐ VERSION ⭐

v1.2.2

πŸ‘‘ AUTHOR πŸ‘‘

Jacques Deguest <jack@deguest.jp>

Copyright (c) 2020-2024 DEGUEST Pte. Ltd.

You can use, copy, modify and redistribute this package and associated files under the same terms as Perl itself.


okay bestie, that's the whole page πŸ’– source/version vibe check: this came from perl v5.42.2, dated 2026-02-15, and yes, it's the Module:...TieHash(3) page. byeeee 🫢🌸

πŸ“¦ where this page comes from