
Bit::MorseSignals::Emitter - Base class for Bit::MorseSignals emitters.

Version 0.06

use Bit::MorseSignals::Emitter;
my $deuce = new Bit::MorseSignals::Emitter;
$deuce->post("hlagh") for 1 .. 3;
while (defined(my $bit = $deuce->pop)) {
sends_by_some_mean_lets_say_signals($bit);
}

Base class for Bit::MorseSignals emitters. Please refer to this module for more general information about the protocol.
The emitter object enqueues messages and prepares them one by one into Bit::MorseSignals packets. It gives then back the bits of the packet in the order they should be sent.

newBit::MorseSignals::Emitter object constructor. Currently does not take any optional argument.
post $msg, < type => $type >Adds $msg to the message queue and, if no other message is currently processed, dequeue the oldest item and prepare it. The type is automatically chosen, but you may want to try to force it with the type option : $type is then one of the BM_DATA_* constants listed in "CONSTANTS" in Bit::MorseSignals
popIf a message is being processed, pops the next bit in the packet. When the message is over, the next in the queue is immediatly prepared and the first bit of the new packet is given back. If the queue is empty, undef is returned. You may want to use this method with the idiom :
while (defined(my $bit = $deuce->pop)) {
...
}
lenThe length of the currently posted message.
posThe number of bits that have already been sent for the current message.
resetCancels the current transfer, but does not empty the queue.
flushFlushes the queue, but does not cancel the current transfer.
busyTrue when the emitter is busy, i.e. when a packet is being chunked.
queuedReturns the number of queued items.

An object module shouldn't export any function, and so does this one.

Carp (standard since perl 5), Encode (since perl 5.007003), Storable (idem).

Bit::MorseSignals, Bit::MorseSignals::Receiver.

Vincent Pit, <perl at profvince.com>, http://www.profvince.com.
You can contact me by mail or on #perl @ FreeNode (vincent or Prof_Vince).

Please report any bugs or feature requests to bug-bit-morsesignals-emitter at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Bit-MorseSignals. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

You can find documentation for this module with the perldoc command.
perldoc Bit::MorseSignals::Emitter
Tests code coverage report is available at http://www.profvince.com/perl/cover/Bit-MorseSignals.

Copyright 2008 Vincent Pit, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.