Tie::Nested - multiple levels of nested tied HASHes and ARRAYs
tie my(%d), 'Tie::Nested', recurse => 'Hash::Case::Lower'; $d{FOO} = 'BAR'; print $d{Foo}; # BAR print $d{fOo}; # BAR print keys %$d; # foo $d{FOO}{BAR} = 42; print Data::Dumper::Dumper \%d; # {foo => {bar => 42}}; $d{nEw} = +{with}{NestEd}{asSIgn => 3}; # works! tie my(%e), 'Tie::Nested' , nestings => ['Hash::Case::Lower', 'Hash::Case::Upper']; $e{FOO}{bar}{Tic} = 42; print Data::Dumper::Dumper \%e; # {foo => {BAR => {Tic => 42}}};
Tie a data-structure automatically. On the top level, we specify for each of the sub-levels how they have to be tied. But after that, we do not need to care.
For instance, we have read/are reading a directory structure for a case-insensitive file-system.
See tie on HASH. You can use ARRAYs as well! All examples are with HASHes, but you are not limited to HASHes!
Tie to a new HASH. The optional DATA contains the initial contents for the HASH.
Either the recurse or the nesting option is required. For examples, see the SYNOPSIS.
recurse
nesting
-Option --Default nesting [] recurse undef
Each of the TIECLASSes implements a tie. For the first level, the first TIECLASS is used. For the second the next, and so forth until you run out of classes. Then, we proceed with
The TIECLASS implements a tie. Each of the nested structures will tie to this same TIECLASS.
This module is part of Tie-Nested distribution version 0.11, built on January 19, 2018. Website: http://perl.overmeer.net/CPAN/
Copyrights 2010-2018 by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://dev.perl.org/licenses/
To install Tie::Nested, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tie::Nested
CPAN shell
perl -MCPAN -e shell install Tie::Nested
For more information on module installation, please visit the detailed CPAN module installation guide.