The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Tie::Nested - multiple levels of nested tied HASHes and ARRAYs

SYNOPSIS

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

DESCRIPTION

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.

METHODS

constructors

ARRAY(, 'Tie::Nested', [DATA], OPTIONS)

See tie on HASH. You can use ARRAYs as well! All examples are with HASHes, but you are not limited to HASHes!

HASH(, 'Tie::Nested', [DATA], OPTIONS)

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.

 -Option --Default
  nesting  []
  recurse  undef
nesting => ARRAY-of-TIECLASS

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

recurse => TIECLASS

The TIECLASS implements a tie. Each of the nested structures will tie to this same TIECLASS.

SEE ALSO

This module is part of Tie-Nested distribution version 0.11, built on January 19, 2018. Website: http://perl.overmeer.net/CPAN/

LICENSE

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/