File: 23-hash-tied.t

package info (click to toggle)
libautovivification-perl 0.18-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 440 kB
  • sloc: perl: 3,573; ansic: 1,507; makefile: 8
file content (27 lines) | stat: -rw-r--r-- 479 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!perl -T

use strict;
use warnings;

use Test::More;

BEGIN {
 eval 'use Tie::Hash; scalar keys %Tie::StdHash::'
                or plan skip_all => 'Tie::StdHash required to test tied hashes';
 defined and diag "Using Tie::StdHash $_" for $Tie::Hash::VERSION;
 plan tests => 1;
}

{
 tie my %x, 'Tie::StdHash';
 tie my %y, 'Tie::StdHash';

 $x{key} = 'hlagh';
 $y{x}   = \%x;

 my $res = do {
  no autovivification;
  $y{x}{key};
 };
 is $res, 'hlagh', 'nested tied hashes';
}