Revision history for Bit-MorseSignals
+0.03 2008-03-03 17:30 GMT
+ + Doc : Clarified synopsises.
+ + Fix : The receiver could access inexistant demanglers if an error
+ occurred during the transfer.
+
0.02 2008-03-01 12:00 GMT
+ Add : The samples/jerk.pl example script.
+ Doc : Typos in POD.
--- #YAML:1.0
name: Bit-MorseSignals
-version: 0.02
+version: 0.03
abstract: The MorseSignals protocol.
license: perl
author:
- Vincent Pit <perl@profvince.com>
-generated_by: ExtUtils::MakeMaker version 6.42
+generated_by: ExtUtils::MakeMaker version 6.44
distribution_type: module
requires:
Carp: 0
Bit::MorseSignals - The MorseSignals protocol.
VERSION
- Version 0.02
+ Version 0.03
+
+SYNOPSIS
+ 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);
DESCRIPTION
In unidirectionnal communication channels (such as networking or IPC),
Bit::MorseSignals::Emitter, Bit::MorseSignals::Receiver.
AUTHOR
- Vincent Pit, "<perl at profvince.com>"
+ Vincent Pit, "<perl at profvince.com>", <http://www.profvince.com>.
You can contact me by mail or on #perl @ FreeNode (vincent or
Prof_Vince).
=head1 VERSION
-Version 0.02
+Version 0.03
=cut
-our $VERSION = '0.02';
+our $VERSION = '0.03';
+
+=head1 SYNOPSIS
+
+ 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);
=head1 DESCRIPTION
=head1 AUTHOR
-Vincent Pit, C<< <perl at profvince.com> >>
+Vincent Pit, C<< <perl at profvince.com> >>, L<http://www.profvince.com>.
You can contact me by mail or on #perl @ FreeNode (vincent or Prof_Vince).
=head1 VERSION
-Version 0.02
+Version 0.03
=cut
-our $VERSION = '0.02';
+our $VERSION = '0.03';
=head1 SYNOPSIS
- use Bit::MorseSignals;
+ use Bit::MorseSignals::Emitter;
my $deuce = new Bit::MorseSignals::Emitter;
$deuce->post("hlagh") for 1 .. 3;
=head1 AUTHOR
-Vincent Pit, C<< <perl at profvince.com> >>
+Vincent Pit, C<< <perl at profvince.com> >>, L<http://www.profvince.com>.
You can contact me by mail or on #perl @ FreeNode (vincent or Prof_Vince).
=head1 VERSION
-Version 0.02
+Version 0.03
=cut
-our $VERSION = '0.02';
+our $VERSION = '0.03';
=head1 SYNOPSIS
- use Bit::MorseSignals;
+ use Bit::MorseSignals::Receiver;
my $pants = new Bit::MorseSignals::Receiver done => sub { print "received $_[1]!\n" };
while (...) {
substr $self->{buf}, -$base, $base, '';
my @demanglers = (sub { $_[0] }, \&decode_utf8, \&thaw );
# BM_DATA_{PLAIN, UTF8, STORABLE}
- $self->{msg} = $demanglers[$self->{type}]->($self->{buf});
+ $self->{msg} = defined $demanglers[$self->{type}]
+ ? $demanglers[$self->{type}]->($self->{buf})
+ : $self->{buf};
$self->reset;
$self->{done}->($self, $self->{msg}) if $self->{done};
return;
=head1 AUTHOR
-Vincent Pit, C<< <perl at profvince.com> >>
+Vincent Pit, C<< <perl at profvince.com> >>, L<http://www.profvince.com>.
You can contact me by mail or on #perl @ FreeNode (vincent or Prof_Vince).
h\x{00}la\x{00}gh \x{00}\x{ff}\x{ff}\x{00}\x{00}\x{ff}/;
my $deuce = new Bit::MorseSignals::Emitter;
-my $pants = new Bit::MorseSignals::Receiver
- done => sub { ok($_[1] eq shift @msgs, "got $_[1]") };
+my $pants = new Bit::MorseSignals::Receiver done => sub {
+ my $cur = shift @msgs;
+ ok($_[1] eq $cur, 'got ' . $_[1] . ', received ' . $cur)
+};
$deuce->post($_) for @msgs;
$pants->push while defined ($_ = $deuce->pop); # ))<>((
ok(!$deuce->busy, 'emitter is no longer busy after all the messages have been sent');
ok(!$pants->busy, 'receiver is no longer busy after all the messages have been got');
-ok(0, "didn\'t got $_") for @msgs;
+ok(0, "didn't got $_") for @msgs;
use Test::More tests => 10;
-use Bit::MorseSignals qw/BM_DATA_STORABLE/;
use Bit::MorseSignals::Emitter;
use Bit::MorseSignals::Receiver;