Revision history for Bit-MorseSignals
+0.02 2008-03-01 12:00 GMT
+ + Add : The samples/jerk.pl example script.
+ + Doc : Typos in POD.
+ + Fix : As the doc says, the datatype should be enforced to PLAIN when
+ the reserved bit is set.
+
0.01 2008-03-01 10:40 GMT
First version, released on an unsuspecting world.
lib/Bit/MorseSignals.pm
lib/Bit/MorseSignals/Emitter.pm
lib/Bit/MorseSignals/Receiver.pm
+samples/jerk.pl
t/00-load.t
t/01-import.t
t/02-can.t
--- #YAML:1.0
name: Bit-MorseSignals
-version: 0.01
+version: 0.02
abstract: The MorseSignals protocol.
license: perl
author:
Bit::MorseSignals - The MorseSignals protocol.
VERSION
- Version 0.01
+ Version 0.02
DESCRIPTION
In unidirectionnal communication channels (such as networking or IPC),
The header is composed of three bits (lowest weight coming first) :
- - The 2 first ones denotes the data type : a value of 0 is used for a
+ - The 2 first ones denote the data type : a value of 0 is used for a
plain string, 1 for an UTF-8 encoded string, and 2 for a Storable
- object. See also the "CONSTANTS" sections ;
+ object. See also the "CONSTANTS" section ;
- The third one is reserved. For compatibility reasons, the receiver
should for now enforce the message data type to plain when this bit is
lit.
=head1 VERSION
-Version 0.01
+Version 0.02
=cut
-our $VERSION = '0.01';
+our $VERSION = '0.02';
=head1 DESCRIPTION
=over 4
-=item - The 2 first ones denotes the data type : a value of 0 is used for a plain string, 1 for an UTF-8 encoded string, and 2 for a L<Storable> object. See also the L</CONSTANTS> sections ;
+=item - The 2 first ones denote the data type : a value of 0 is used for a plain string, 1 for an UTF-8 encoded string, and 2 for a L<Storable> object. See also the L</CONSTANTS> section ;
=item - The third one is reserved. For compatibility reasons, the receiver should for now enforce the message data type to plain when this bit is lit.
=head1 VERSION
-Version 0.01
+Version 0.02
=cut
-our $VERSION = '0.01';
+our $VERSION = '0.02';
=head1 SYNOPSIS
=head2 C<new>
-L<Bit::MorseSignal::Emitter> object constructor. Currently does not take any optional argument.
+L<Bit::MorseSignals::Emitter> object constructor. Currently does not take any optional argument.
=cut
=head1 VERSION
-Version 0.01
+Version 0.02
=cut
-our $VERSION = '0.01';
+our $VERSION = '0.02';
=head1 SYNOPSIS
=head2 C<< new [ done => $cb ] >>
-L<Bit::MorseSignal::Receiver> 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.
+L<Bit::MorseSignals::Receiver> 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
if ($self->{len} >= 3) {
my $type = 2 * vec($self->{buf}, 0, 1)
+ vec($self->{buf}, 1, 1);
+ $type = BM_DATA_PLAIN if vec($self->{buf}, 2, 1);
@{$self}{qw/state type buf len/} = (3, $type, '', 0);
}
--- /dev/null
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+use lib qw{blib/lib};
+use Bit::MorseSignals::Emitter;
+use Bit::MorseSignals::Receiver;
+
+my $deuce = new Bit::MorseSignals::Emitter;
+my $pants = new Bit::MorseSignals::Receiver done => sub { print $_[1], "\n" };
+
+$deuce->post('HLAGH') for 1 .. 3;
+$pants->push while defined ($_ = $deuce->pop);