
budman
User
Feb 12, 2012, 11:57 AM
Post #4 of 4
(1669 views)
|
|
Re: [samir.gambler] Sharing object in perl
[In reply to]
|
Can't Post
|
|
Since a blessed object ref is returned, you need to use the shared_clone. I don't have Windows to test, but did a sample below. from docs: Shared variables can only store scalars, refs of shared variables, or refs of shared data. $ro_api = Win32::OLE->new("xxx.xxx");
package Test; use Moose; has 'name' => ( is => 'rw', isa => 'Str'); package main; use threads; use threads::shared; my $testobj = Test->new(name=>'test name'); my $var :shared = shared_clone($testobj); print "Test: ",$testobj->name()."\n"; print "Var: ",$var->name(),"\n"; Test: test name Var: test name
|