As per the documentation quoted by kcott, shared variables are valid only if all parts (other than “simple values”, i.e., non-reference scalars) are explicitly shared. So, to declare and initialise the hash, you will need syntax something like this:
my %host_info :shared = ( 1 => &share ( { hostname => 'somehost@somewhere.com', host_info => &share ( { info => 'valueA', info2 => 'valueB', info3 => 'valueA', } ), } ), 2 => &share ( { hostname => 'someotherhost@somewhere.com', host_info => &share ( { info => 'valueA', info2 => 'valueB', info3 => 'valueA', } ), } ), );
See Re^3: How to share complex data structure in threads ? by BrowserUk.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: Threads, DBI, Shared Variables problem
by Athanasius
in thread Threads, DBI, Shared Variables problem
by xajin25
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |