Module::Generic::TieHash - Generic Tie Hash Mechanism for Object Oriented Hashes
=head1 SYNOPSIS
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';
=head1 DESCRIPTION
This module implements a tied hash mechanism that accepts as keys strings or references, if the option C<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 L<Storable>
The constructor C<TIEHASH> supports the following options provided as an hash reference:
=over 4
=item * C<debug>
The debug value as an integer.
=item * C<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, L<Module::Generic> is part of the exclusion list for which this tied object is disabled.
=item * C<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.
=back
Also, if you set the global variable C<$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.
=head1 VERSION
v1.2.2
=for Pod::Coverage key_object
=head1 AUTHOR
Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
=head1 COPYRIGHT & LICENSE
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.
=cut
Keyboard Shortcuts
Global
s
Focus search bar
?
Bring up this help dialog
GitHub
gp
Go to pull requests
gi
go to github issues (only if github is preferred repository)