From: Vincent Pit Date: Sun, 29 Jun 2008 15:11:28 +0000 (+0200) Subject: Importing Bit-MorseSignals-0.02.tar.gz X-Git-Tag: v0.02^0 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=ed888890547450e75030085fadb958c5ea2a6421;p=perl%2Fmodules%2FBit-MorseSignals.git Importing Bit-MorseSignals-0.02.tar.gz --- diff --git a/Changes b/Changes index 998da23..9402d8f 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,11 @@ 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. diff --git a/MANIFEST b/MANIFEST index ca416e6..71cde0b 100644 --- a/MANIFEST +++ b/MANIFEST @@ -5,6 +5,7 @@ README 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 diff --git a/META.yml b/META.yml index 2609298..9c92978 100644 --- a/META.yml +++ b/META.yml @@ -1,6 +1,6 @@ --- #YAML:1.0 name: Bit-MorseSignals -version: 0.01 +version: 0.02 abstract: The MorseSignals protocol. license: perl author: diff --git a/README b/README index 63b4b80..0420536 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ NAME Bit::MorseSignals - The MorseSignals protocol. VERSION - Version 0.01 + Version 0.02 DESCRIPTION In unidirectionnal communication channels (such as networking or IPC), @@ -27,9 +27,9 @@ PROTOCOL 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. diff --git a/lib/Bit/MorseSignals.pm b/lib/Bit/MorseSignals.pm index b2afc84..a8d13f6 100644 --- a/lib/Bit/MorseSignals.pm +++ b/lib/Bit/MorseSignals.pm @@ -9,11 +9,11 @@ Bit::MorseSignals - The MorseSignals protocol. =head1 VERSION -Version 0.01 +Version 0.02 =cut -our $VERSION = '0.01'; +our $VERSION = '0.02'; =head1 DESCRIPTION @@ -39,7 +39,7 @@ The header is composed of three bits (lowest weight coming first) : =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 object. See also the L 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 object. See also the L 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. diff --git a/lib/Bit/MorseSignals/Emitter.pm b/lib/Bit/MorseSignals/Emitter.pm index 44fec24..9d0273a 100644 --- a/lib/Bit/MorseSignals/Emitter.pm +++ b/lib/Bit/MorseSignals/Emitter.pm @@ -15,11 +15,11 @@ Bit::MorseSignals::Emitter - Base class for Bit::MorseSignals emitters. =head1 VERSION -Version 0.01 +Version 0.02 =cut -our $VERSION = '0.01'; +our $VERSION = '0.02'; =head1 SYNOPSIS @@ -64,7 +64,7 @@ sub _count_bits { =head2 C -L object constructor. Currently does not take any optional argument. +L object constructor. Currently does not take any optional argument. =cut diff --git a/lib/Bit/MorseSignals/Receiver.pm b/lib/Bit/MorseSignals/Receiver.pm index 42f6b4f..0dd41aa 100644 --- a/lib/Bit/MorseSignals/Receiver.pm +++ b/lib/Bit/MorseSignals/Receiver.pm @@ -15,11 +15,11 @@ Bit::MorseSignals::Receiver - Base class for Bit::MorseSignals receivers. =head1 VERSION -Version 0.01 +Version 0.02 =cut -our $VERSION = '0.01'; +our $VERSION = '0.02'; =head1 SYNOPSIS @@ -48,7 +48,7 @@ sub _check_self { =head2 C<< 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. +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 @@ -111,6 +111,7 @@ sub push { 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); } diff --git a/samples/jerk.pl b/samples/jerk.pl new file mode 100755 index 0000000..3ff215b --- /dev/null +++ b/samples/jerk.pl @@ -0,0 +1,14 @@ +#!/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);