Vincent Pit > Bit-MorseSignals > Bit::MorseSignals::Receiver

Download:
Bit-MorseSignals-0.08.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.08   Source  

NAME ^

Bit::MorseSignals::Receiver - Base class for Bit::MorseSignals receivers.

VERSION ^

Version 0.08

SYNOPSIS ^

    use Bit::MorseSignals::Receiver;

    my $pants = Bit::MorseSignals::Receiver->new(done => sub { print "received $_[1]!\n" });
    while (...) {
     my $bit = comes_from_somewhere_lets_say_signals();
     $pants->push($bit);
    }

DESCRIPTION ^

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.

METHODS ^

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.

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.

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.

EXPORT ^

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

DEPENDENCIES ^

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

SEE ALSO ^

Bit::MorseSignals, Bit::MorseSignals::Emitter.

AUTHOR ^

Vincent Pit, <perl at profvince.com>, http://www.profvince.com.

You can contact me by mail or on irc.perl.org (vincent).

BUGS ^

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.

SUPPORT ^

You can find documentation for this module with the perldoc command.

    perldoc Bit::MorseSignals::Receiver

Tests code coverage report is available at http://www.profvince.com/perl/cover/Bit-MorseSignals.

COPYRIGHT & LICENSE ^

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.

syntax highlighting: