Module:...ic::Tie(3)
π NAME π
Module::Generic::Tie β bestie, it's the Object Access Control Class β¨ (and yes, it's from the User Contributed Perl Documentation section, iykyk π)
πΈ SYNOPSIS πΈ
my $o = My::Object->new;
tie( $o, 'Module::Generic::Tie', readonly => 1, perms => 4 );
# Attempting to change the debug level directly
$o->{debug} = 1;
# This fails, because the object is set with read only permision
# but this below will succeed
$o->debug( 1 );
okay so look at that little demo π β you tie the object with readonly => 1 and perms => 4, and then the direct hash access $o->{debug} = 1 just does not go through (the comment literally says "This fails, because the object is set with read only permision" β yes, that typo is canon, keeping it verbatim π), but calling the method $o->debug( 1 ) totally slays through. fr fr. π«Ά
π¦ VERSION π¦
v1.2.0 β that's the one, bestie β
β¨ DESCRIPTION β¨
So here's the vibe: you hand this module an object plus a set of parameters, and it restricts direct access to the object's values β meaning it makes sure those properties can only be modified from inside the class/package when that's necessary π.
Where you'll actually see it: this is used in "new" in Module::Generic, using your module's global variable OBJECT_PERMS. And what goes in OBJECT_PERMS? A unix permission β a number from 1 to 7 that's a combinatin (again, their spelling, not mine, preserving it π) of:
1β execution2β write privilege4β read privilege
so like, classic unix perms energy, but for your object π
π METHODS π
No method is available.
That's it. That's the section. Literally nothing. Not me showing up to the methods section and finding it empty ππ
π₯ THREAD SAFETY π₯
Okay this part matters, so lock in π:
This module does not implement locking or synchronization for tied hashes shared across threads. No cap, none.
To avoid data races:
- Do not share tied hash instances between threads
- Or use external synchronization (e.g.,
lock()) before accessing or modifying values
And the big takeaway: this module is designed primarily for permission-based encapsulation, not concurrency control. So don't come for it expecting thread magic, bestie, it will not give you that π
π§ AUTHOR π§
Jacques Deguest <jack@deguest.jp> β ty for your service π«Ά
π COPYRIGHT & LICENSE π
Copyright (c) 2000-2024 DEGUEST Pte. Ltd.
You can use, copy, modify and redistribute this package and associated files under the same terms as Perl itself. π
and that's the whole page, bestie! πΈ this lil number is from perl v5.42.2, dated 2026-02-15, and honestly? iconic. go forth and tie responsibly β¨π¦π
π¦ where this page comes from
- alpine 3.24: perl-module-generic-doc 1.1.3-r1 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms