Bit::MorseSignals::Emitter - Base class for Bit::MorseSignals emitters.
Version 0.08
use Bit::MorseSignals::Emitter; my $deuce = Bit::MorseSignals::Emitter->new; $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.
new
Bit::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
$msg
type
$type
BM_DATA_*
pop
If 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 :
undef
while (defined(my $bit = $deuce->pop)) { ... }
len
The length of the currently posted message.
pos
The number of bits that have already been sent for the current message.
reset
Cancels the current transfer, but does not empty the queue.
flush
Flushes the queue, but does not cancel the current transfer.
busy
True when the emitter is busy, i.e. when a packet is being chunked.
queued
Returns 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.
<perl at profvince.com>
You can contact me by mail or on irc.perl.org (vincent).
irc.perl.org
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.
bug-bit-morsesignals-emitter at rt.cpan.org
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.
To install Bit::MorseSignals, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bit::MorseSignals
CPAN shell
perl -MCPAN -e shell install Bit::MorseSignals
For more information on module installation, please visit the detailed CPAN module installation guide.