Home  |  Linux  | Mysql  | PHP  | XML
From:Jerry D. Hedden Date:Mon Jul 14 09:41:28 2008
Subject:Re: Calling a object method in a create()
Valter Douglas Lisbôa Jr. wrote:
> The code bellow functions very nice.
>
> ---------------------
> while(my ($id, $ep, $local, $tolerance, $lasterr, $hostscount) =
> $sthLocals->fetchrow_array()) {
>  $self->localPolling($id, $ep, $local, $tolerance, $lasterr, $hostscount);
> }
> ---------------------
>
> But if I try to execute with a thread:
>
> ---------------------
> while(my ($id, $ep, $local, $tolerance, $lasterr, $hostscount) =
> $sthLocals->fetchrow_array()) {
>  my $thr = threads->create($self->localPooling, $id, $ep, $local, $tolerance,
> $lasterr, $hostscount);
> }
> ---------------------
>
> It returns a error:
> Can't locate object method "localPooling" via package "Poller::Check"!

Try

while (my ($id, $ep, $local, $tolerance, $lasterr, $hostscount)
            = $sthLocals->fetchrow_array())
{
    my $thr = threads->create(sub {
        $self->localPooling($id, $ep, $local, $tolerance, $lasterr,
$hostscount);
    });
}
Navigate in group perl.ithreads at sever nntp.perl.org
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants