Seems that if I also pass the keys as references as well, it works in
my test.  I was assuming that sharing/passing the main hash would cover it,
but I wasa mistaken.  Reading all the perldocs will drive you crazy
in a couple of days though!

Thanks,

Greg

On Thu, 05 Sep 2002 09:09:29 +0200
Elizabeth Mattijsen <[EMAIL PROTECTED]> wrote:

> At 04:01 PM 9/4/02 -0500, Greg Oliver wrote:
> >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.
> 
> You would need to tie each of the sub hashes seperately, that should 
> work.  If someone could point me to a way to have this automatically 
> happen, I would like to know.
> 
> 
> >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.
> 
> Could you post me some of your code, offline if you will, so that I can 
> have a look at what exactly is going wrong, either in the code, the 
> documentation, my head and/or your head?   ;-)   I have programs running 
> that do exactly what you describe (well, what I can gather from your 
> description ;-)
> 
> 
> 
> Liz
> 

Reply via email to