Syntactic Confectionery Delight | |
PerlMonks |
Re: $threads->join() only returns one argument??? BUG?by Chmrr (Vicar) |
on Jun 12, 2003 at 03:39 UTC ( [id://265269]=note: print w/replies, xml ) | Need Help?? |
This is pretty obviously a bug. The context that is applied to the $thr->join call is the context that the threads->new call was in. That is:
..fails, while..
..works fine. Note the difference in parens on the my $thr line. I'm going to poke at the threads code on this one. Update: Upon reflection and looking at the code, it makes sense in a perverse way. Because the subroutine/thread starts execution upon creation, someone could call wantarray from it off the top. If the context was determined at join time, there would be no way to determine the proper wantarray value. In fact, this behavior is documented in bleedperl's threads.pm (search for "context"). perl -pe '"I lo*`+$^X$\"$]!$/"=~m%(.*)%s;$_=$1;y^`+*^e v^#$&V"+@( NO CARRIER'
In Section
Seekers of Perl Wisdom
|
|