NAME

Module::Generic::Tie - Object Access Control Class

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 );

VERSION

v1.2.0

DESCRIPTION

Given an object, and a set of parameters, this will restrict direct access to the object values, ensuring the object properties can only be modified from within the class/package if necessary.

This is used in "new" in Module::Generic using your module global variable OBJECT_PERMS which should contain a unix permission which is a number from 1 to 7 representing a combinatin of 1 for execution, 2 for write privilege and 4 for read privilege

METHODS

No method is available

THREAD SAFETY

This module does not implement locking or synchronization for tied hashes shared across threads.

To avoid data races:

  • Do not share tied hash instances between threads

  • Or use external synchronization (e.g., lock()) before accessing or modifying values

This module is designed primarily for permission-based encapsulation, not concurrency control.

AUTHOR

Jacques Deguest <jack@deguest.jp>

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.