Re: returning array refs from Thread::Queue::Any

2002-10-28 Thread Elizabeth Mattijsen
At 02:44 PM 10/27/02 -1000, Joshua Hoblitt wrote: -- use strict; sub myfunc { wantarray ? [1, 2] : 3; } my( $one, $two ) = @{ &myfunc }; print "$one, $two\n"; -- One would expect that to work but the context is getting lost. That's exactly the problem: the @{} is forcing scalar contex

Re: returning array refs from Thread::Queue::Any

2002-10-27 Thread Joshua Hoblitt
Liz, I just saw your thread on p5p about this. Consider this... -- use strict; sub myfunc { wantarray ? [1, 2] : 3; } my( $one, $two ) = @{ &myfunc }; print "$one, $two\n"; -- One would expect that to work but the context is getting lost. -J -- "Suppose you were an idiot. And supp

Re: returning array refs from Thread::Queue::Any

2002-10-27 Thread Joshua Hoblitt
my( $one, $two ) = @{ ($q->dequeue_dontwait)[0] }; works. line 104: while ( my( $host, $ret ) = @{ ($q->dequeue_dontwait)[0] } ) { throws: thread failed to start: Can't use an undefined value as an ARRAY reference at lib/PolycomStatus.pm line 104 I'd be happy to share the whole module with y

Re: returning array refs from Thread::Queue::Any

2002-10-27 Thread Elizabeth Mattijsen
At 10:41 AM 10/27/02 -1000, Joshua Hoblitt wrote: > my( $one, $two ) = @{ ($q->dequeue_dontwait)[0] }; This is causing a compile error for me. I tried just [] as well. [Sun Oct 27 10:31:57 2002] PolycomStatus.pm: syntax error at PolycomStatus.pm line 104, near "->dequeue_dontwait[" [Sun Oct 27

Re: returning array refs from Thread::Queue::Any

2002-10-27 Thread Joshua Hoblitt
> my( $one, $two ) = @{ ($q->dequeue_dontwait)[0] }; This is causing a compile error for me. I tried just [] as well. [Sun Oct 27 10:31:57 2002] PolycomStatus.pm: syntax error at PolycomStatus.pm line 104, near "->dequeue_dontwait[" [Sun Oct 27 10:31:57 2002] PolycomStatus.pm: PolycomStatus.pm

Re: returning array refs from Thread::Queue::Any

2002-10-27 Thread Elizabeth Mattijsen
At 01:43 PM 10/27/02 +0200, Elizabeth Mattijsen wrote: At 06:01 PM 10/26/02 -1000, Joshua Hoblitt wrote: I was wondering why: -- my( $one, $two ) = @{ $q->dequeue_dontwait }; print "$one, $two\n"; Try: my( $one, $two ) = @{ ($q->dequeue_dontwait)[0] }; The @{ } forces scalar context within t

Re: returning array refs from Thread::Queue::Any

2002-10-27 Thread Elizabeth Mattijsen
At 06:01 PM 10/26/02 -1000, Joshua Hoblitt wrote: I was wondering why: -- my( $one, $two ) = @{ $q->dequeue_dontwait }; print "$one, $two\n"; -- Doesn't work but: -- my( $list ) = $q->dequeue_dontwait; my( $one, $two ) = @{ $list }; print "$one, $two\n"; -- Does? Actually, I have no idea. I've