Hi, I am just diving into Perl and threads especially.
I am using Thread::Pool, Thread::Use, Thread::Tie and LWP::UserAgent
in my script. LWP::UserAgent is local to the subroutine with Thread::Use
which is a 3 level hash of hashes. No problem, I can use it just fine
anywhere in the program. I cannot Thread::Tie is like I can any of
my other %s or @s though. Single hashes and all arrays seem to work as
expected.
The script basically runs through a city/domain/engine combination
and gets a result for each. It is "supposed" to store the results
into the main %Results so I can print it out after all of the LWP
requests are complete, but as soon as the has is updated (and I can
check and see it is) and the subroutine is finished for that
particular combination, the hash entry disappears.
I can remove all threading points from the program, run it synchronous
(very slow), and all the problems go away.
I have tried:
o Passing %Results as a reference to the subroutine
o Passing nothing, and just trying to update the global
o Running $pool->waitfor (get results, and can update from main
portion of program outside the subroutine, but is just like
running non-threaded if I have to wait :)
I have not successfully been able to Thread::Tie the %HoHoH as well. Probably
related and something I do not know how to do. Also, I know I can use POE
for this, but what is the fun in that? I am just trying to learn a little,
but sometimes it gets a bit confusing.
Thanks,
Greg