Re: Calling a object method in a create()

[email protected] ("Valter Douglas LisbĂ´a Jr.") Mon, 14 Jul 2008 13:32:38 -0300
Newsgroups perl.ithreads
Organization Trenix - IT Solutions
Message-ID <[email protected]>
Thanks, it worked!=20

On Monday 14 July 2008 12:41:28 Jerry D. Hedden wrote:
> Valter Douglas Lisb=F4a Jr. wrote:
> > The code bellow functions very nice.
> >
> > ---------------------
> > while(my ($id, $ep, $local, $tolerance, $lasterr, $hostscount) =3D
> > $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) =3D
> > $sthLocals->fetchrow_array()) {
> >  my $thr =3D 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)
>             =3D $sthLocals->fetchrow_array())
> {
>     my $thr =3D threads->create(sub {
>         $self->localPooling($id, $ep, $local, $tolerance, $lasterr,
> $hostscount);
>     });
> }



=2D-=20
Valter Douglas Lisb=F4a Jr.
S=F3cio-Diretor
Trenix - IT Solutions
"Nossas Id=E9ias, suas Solu=E7=F5es!"
www.trenix.com.br
[email protected]
Tel. +55 19 3402.2957
Cel. +55 19 9183.4244