use strict ; use warnings ; use feature 'say' ; use Clone 'clone' ; use MCE::Hobo ; use MCE::Shared ; use Data::Dumper ; my $data = { key => 1, nested => { key => 1 } } ; tie my %hash_a, 'MCE::Shared', { module => 'MCE::Shared::Hash' }, %{ clone($data) } ; tie my %hash_b, 'MCE::Shared', { module => 'MCE::Shared::Hash' } ; tie my %hash_c, 'MCE::Shared', %{ clone($data) } ; # defaults to MCE::Shared::Hash tie my %hash_d, 'MCE::Shared' ; %hash_b = %{ clone($data) } ; %hash_d = %{ clone($data) } ; mce_async { $hash_a{key}++ ; $hash_a{nested}{key}++ ; $hash_b{key}++ ; $hash_b{nested}{key}++ ; $hash_c{key}++ ; $hash_c{nested}{key}++ ; $hash_d{key}++ ; $hash_d{nested}{key}++ ; my $_a = $hash_a{nested} ; $_a->{key}++ ; my $_b = $hash_b{nested} ; $_b->{key}++ ; my $_c = $hash_c{nested} ; $_c->{key}++ ; my $_d = $hash_d{nested} ; $_d->{key}++ ; say "ref nested_a: ", ref($_a) ; say "ref nested_b: ", ref($_b) ; say "ref nested_c: ", ref($_c) ; say "ref nested_d: ", ref($_d) ; say "" ; } ; MCE::Hobo->waitall ; say "a: ", Dumper( tied(%hash_a)->export ) ; # not deeply shared say "b: ", Dumper( tied(%hash_b)->export ) ; # ok say "c: ", Dumper( tied(%hash_c)->export ) ; # ok say "d: ", Dumper( tied(%hash_d)->export ) ; # ok