Mark Overmeer > Tie-Nested-0.10 > Tie::Nested

Download:
Tie-Nested-0.10.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.10   Source  

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.10, built on February 15, 2010. Website: http://perl.overmeer.net/tie-nested

LICENSE ^

Copyrights 2010 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://www.perl.com/perl/misc/Artistic.html

syntax highlighting: