Calling a object method in a create()

[email protected] ("Valter Douglas LisbĂ´a Jr.") Mon, 14 Jul 2008 11:22:26 -0300
Newsgroups perl.ithreads
Organization Trenix - IT Solutions
Message-ID <[email protected]>
Hi all,

I new on threads, but not so on perl.

I trying to execute a thread inside a object method of a class that I make =
to=20
consult SNMP quests and feed a rrddatabase.

The code bellow functions very nice.

=2D--------------------
while(my ($id, $ep, $local, $tolerance, $lasterr, $hostscount) =3D=20
$sthLocals->fetchrow_array()) {
  $self->localPolling($id, $ep, $local, $tolerance, $lasterr, $hostscount);
}
=2D--------------------

But if I try to execute with a thread:

=2D--------------------
while(my ($id, $ep, $local, $tolerance, $lasterr, $hostscount) =3D=20
$sthLocals->fetchrow_array()) {
  my $thr =3D threads->create($self->localPooling, $id, $ep, $local, $toler=
ance,=20
$lasterr, $hostscount);
}
=2D--------------------

It returns a error:
Can't locate object method "localPooling" via package "Poller::Check"!

I try to put a \& before $self-> and take another error:
Not a code reference

Are there a way to call a class $self->method in a thread? I search across=
=20
Google and not find any clue.

Thanks in advance.

=2D-=20
Valter Douglas Lisb=C3=B4a Jr.
S=C3=B3cio-Diretor
Trenix - IT Solutions
"Nossas Id=C3=A9ias, suas Solu=C3=A7=C3=B5es!"
www.trenix.com.br
[email protected]
Tel. +55 19 3402.2957
Cel. +55 19 9183.4244