X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FBit%2FMorseSignals%2FReceiver.pm;h=0eb8751ff293a7afa74ccbbe61cf3364e3d7ac2a;hb=f38dcd0ed41b4fd271ba4905528f992f9e2cd0fc;hp=9cbb8b19bce2c3d3690f180bda2fb05106005c7e;hpb=a6066756b2f156893cc18bb33c4f55af672c588b;p=perl%2Fmodules%2FBit-MorseSignals.git diff --git a/lib/Bit/MorseSignals/Receiver.pm b/lib/Bit/MorseSignals/Receiver.pm index 9cbb8b1..0eb8751 100644 --- a/lib/Bit/MorseSignals/Receiver.pm +++ b/lib/Bit/MorseSignals/Receiver.pm @@ -25,7 +25,9 @@ our $VERSION = '0.08'; use Bit::MorseSignals::Receiver; - my $pants = Bit::MorseSignals::Receiver->new(done => sub { print "received $_[1]!\n" }); + my $pants = Bit::MorseSignals::Receiver->new( + done => sub { print "received $_[1]!\n" }, + ); while (...) { my $bit = comes_from_somewhere_lets_say_signals(); $pants->push($bit); @@ -33,7 +35,8 @@ our $VERSION = '0.08'; =head1 DESCRIPTION -Base class for L receivers. Please refer to this module for more general information about the protocol. +Base class for L receivers. +Please refer to this module for more general information about the protocol. Given a sequence of bits coming from the L 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. @@ -46,9 +49,12 @@ sub _check_self { =head1 METHODS -=head2 C<< new < done => $cb > >> +=head2 C -L object constructor. With the C<'done'> option, you can specify a callback that will be triggered every time a message is completed, and in which C<$_[0]> will be the receiver object and C<$_[1]> the message received. + my $bmr = Bit::MorseSignals::Receiver->new(done => $cb); + +L object constructor. +With the C<'done'> option, you can specify a callback that will be triggered every time a message is completed, and in which C<$_[0]> will be the receiver object and C<$_[1]> the message received. =cut @@ -66,9 +72,12 @@ sub new { return $self; } -=head2 C +=head2 C + + $bmr->push($bit); -Tells the receiver that you have received the bit C<$bit>. Returns true while the message isn't completed, and C as soon as it is. +Tells the receiver that you have received the bit C<$bit>. +Returns true while the message isn't completed, and C as soon as it is. =cut @@ -182,7 +191,7 @@ An object module shouldn't export any function, and so does this one. =head1 DEPENDENCIES -L (standard since perl 5), L (since perl 5.007003), L (idem). +L (standard since perl 5), L (since perl 5.7.3), L (idem). =head1 SEE ALSO @@ -196,7 +205,8 @@ You can contact me by mail or on C (vincent). =head1 BUGS -Please report any bugs or feature requests to C, or through the web interface at L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. +Please report any bugs or feature requests to C, or through the web interface at L. +I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. =head1 SUPPORT