in reply to Threads, DBI, Shared Variables problem
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, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Threads, DBI, Shared Variables problem
by xajin25 (Initiate) on May 26, 2013 at 16:42 UTC |