我已经搜索了相关主题,但仍然无法解决这个问题...
use threads;
my $person = new Person( 'Name' => "yy");
my $udp_thread = threads->new(\&udp_func);
while(1)
{
$person->working();
}
sub udp_func
{
#Can't call method "setName" on an undefined value:
$person->setName();
}
我该如何在新线程中访问对象$person?非常感谢!