Coro::Channel - message queues
use Coro::Channel; $q1 = new Coro::Channel <maxsize>; $q1->put("xxx"); print $q1->get; die unless $q1->size;
Create a new channel with the given maximum size (unlimited if maxsize is omitted). Stating a size of zero gives you a traditional channel, i.e. a queue that can store only a single element.
maxsize
Put the given scalar into the queue.
Return the next element from the queue, waiting if necessary.
Return the number of elements waiting to be consumed. Please note that:
if ($q->size) { my $data = $q->get; }
is NOT a race condition but works fine.
Marc Lehmann <pcg@goof.com> http://www.goof.com/pcg/marc/
To install Coro, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Coro
CPAN shell
perl -MCPAN -e shell install Coro
For more information on module installation, please visit the detailed CPAN module installation guide.