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

2002-10-29 Thread Joshua Hoblitt
> But I see that you may have a misconception about what enqueue adds and > dequeue(_nb) removes. "enqueue" packages up _all_ of the parameters into a > single "package" in the queue, which is returned as one set of parameters > by "dequeue(_nb)". Try this: > > while ( my( $one, $two ) = $q->dequ

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

2002-10-29 Thread Elizabeth Mattijsen
At 10:07 PM 10/28/02 -1000, Joshua Hoblitt wrote: > Could you give me an example which gives you the error? I'd be surprised... -- use strict; use Thread::Queue::Any; my $q = Thread::Queue::Any->new(); $q->enqueue( [ 1, 2 ], [ 3, 4 ] ); while ( my( $one, $two ) = @{ ($q->dequeue_nb)[0] } ) {

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

2002-10-29 Thread Joshua Hoblitt
> Could you give me an example which gives you the error? I'd be surprised... -- use strict; use Thread::Queue::Any; my $q = Thread::Queue::Any->new(); $q->enqueue( [ 1, 2 ], [ 3, 4 ] ); while ( my( $one, $two ) = @{ ($q->dequeue_nb)[0] } ) { print "$one, $two\n"; } -- Can't use an u

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

2002-10-28 Thread Elizabeth Mattijsen
At 11:14 AM 10/28/02 -1000, Joshua Hoblitt wrote: > That's exactly the problem: the @{} is forcing scalar context, so that it > tries to deref the value 1 always (which you'll see if you're using strict). I understand now... is there a pretty way to force the calling context? Using (...)[0] is c

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

2002-10-28 Thread Joshua Hoblitt
> That's exactly the problem: the @{} is forcing scalar context, so that it > tries to deref the value 1 always (which you'll see if you're using strict). I understand now... is there a pretty way to force the calling context? Using (...)[0] is causing errors for me. -J