Bit::MorseSignals::Receiver - Base class for Bit::MorseSignals receivers.
Version 0.03
use Bit::MorseSignals::Receiver; my $pants = new Bit::MorseSignals::Receiver done => sub { print "received $_[1]!\n" }; while (...) { my $bit = comes_from_somewhere_lets_say_signals(); $pants->push($bit); }
Base class for Bit::MorseSignals receivers. Please refer to this module for more general information about the protocol.
Given a sequence of bits coming from the Bit::MorseSignals protocol, the receiver object detects when a packet has been completed and then reconstructs the original message depending of the datatype specified in the header.
new [ done => $cb ]
Bit::MorseSignals::Receiver object constructor. With the 'done' option, you can specify a callback that will be triggered every time a message is completed, and in which $_[0] will be the receiver object and $_[1] the message received.
'done'
$_[0]
$_[1]
push $bit
Tells the receiver that you have received the bit $bit. Returns true while the message isn't completed, and undef as soon as it is.
$bit
undef
reset
Resets the current receiver state, obliterating any current message being received.
busy
True when the receiver is in the middle of assembling a message.
msg
The last message completed, or undef when no message has been assembled yet.
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::Emitter.
Vincent Pit, <perl at profvince.com>, http://www.profvince.com.
<perl at 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-receiver 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-receiver at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Bit::MorseSignals::Receiver
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.