Revision history for IPC-MorseSignals
+0.13 2008-03-10 15:25 UTC
+ + Chg : Build prerequisites are now completely separated from run-time
+ prerequisites.
+ + Doc : The usual set of POD typos.
+ + Tst : Changed SIGHUP handlers in the parent for SIGUSR1's.
+ + Tst : Changed SIGHUP handlers in the child for SIGTSTP's.
+ + Tst : Meaningful fork tests labels.
+ + Tst : More synchronization barriers.
+ + Tst : Safe kills.
+
0.12 2008-03-09 10:20 UTC
+ Doc : POD tweaks.
+ Fix : Correct Makefile.PL die messages.
--- #YAML:1.0
name: IPC-MorseSignals
-version: 0.12
+version: 0.13
abstract: Communicate between processes with Morse signals.
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:
Bit::MorseSignals: 0
Carp: 0
- Data::Dumper: 0
- Exporter: 0
- ExtUtils::MakeMaker: 0
POSIX: 0
- Test::More: 0
Time::HiRes: 0
- utf8: 0
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.3.html
version: 1.3
build_requires:
+ Config: 0
Data::Dumper: 0
Exporter: 0
ExtUtils::MakeMaker: 0
my $BUILD_REQUIRES = {
'utf8' => 0,
+ 'Config' => 0,
'Data::Dumper' => 0,
'Exporter' => 0,
'ExtUtils::MakeMaker' => 0,
'Carp' => 0,
'POSIX' => 0,
'Time::HiRes' => 0,
- %$BUILD_REQUIRES
},
dist => {
PREOP => 'pod2text lib/IPC/MorseSignals.pm > $(DISTVNAME)/README; '
IPC::MorseSignals - Communicate between processes with Morse signals.
VERSION
- Version 0.12
+ Version 0.13
SYNOPSIS
# In the sender process
=head1 VERSION
-Version 0.12
+Version 0.13
=cut
-our $VERSION = '0.12';
+our $VERSION = '0.13';
=head1 SYNOPSIS
=head1 VERSION
-Version 0.12
+Version 0.13
=cut
-our $VERSION = '0.12';
+our $VERSION = '0.13';
=head1 SYNOPSIS
=head1 VERSION
-Version 0.12
+Version 0.13
=cut
-our $VERSION = '0.12';
+our $VERSION = '0.13';
=head1 SYNOPSIS
init 6;
-test 'plain' => $_ for @msgs;
+for (0 .. $#msgs) {
+ test 'plain ' . $_ => $msgs[$_];
+}
cleanup;
init 6;
-test 'plain' => $_ for @msgs;
+for (0 .. $#msgs) {
+ test 'utf8 ' . $_ => $msgs[$_];
+}
cleanup;
init 6;
-test 'plain' => $_ for @msgs;
+for (0 .. $#msgs) {
+ test 'storable ' . $_ => $msgs[$_];
+}
cleanup;
# Ensure a recent version of Test::Pod::Coverage
my $min_tpc = 1.08;
eval "use Test::Pod::Coverage $min_tpc";
-plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage"
- if $@;
+plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage" if $@;
# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version,
# but older versions don't recognize some common documentation styles
my $min_pc = 0.18;
eval "use Pod::Coverage $min_pc";
-plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage"
- if $@;
+plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage" if $@;
all_pod_coverage_ok(
-# also_private => [ qr/^_/ ]
+ { also_private => [ qr/^_/ ] }
);
use warnings;
use Data::Dumper;
-use POSIX qw/pause SIGINT SIGTERM SIGKILL SIGHUP EXIT_FAILURE/;
+use POSIX qw/pause SIGUSR1 SIGTSTP SIGKILL EXIT_FAILURE/;
use IPC::MorseSignals::Emitter;
use IPC::MorseSignals::Receiver;
my ($lives, $pid, $rdr);
+my $ready = 0;
+$SIG{USR1} = sub { $ready = 1 };
+
sub spawn {
--$lives;
die 'forked too many times' if $lives < 0;
close $rdr or die "close() failed: $!";
select $wtr;
$| = 1;
- $SIG{__WARN__} = sub { print $wtr "!warn\n"; };
+ my $ppid = getppid;
my $rcv = new IPC::MorseSignals::Receiver \%SIG, done => sub {
print $wtr Dumper($_[1]), "\n";
+ kill SIGUSR1 => $ppid if $ppid;
};
- my $ppid = getppid;
- $SIG{ALRM} = sub { alarm 1; kill SIGHUP => $ppid };
- alarm 1;
- $SIG{HUP} = sub { alarm 0; $rcv->reset }; # We can reset the alarm here.
+ $SIG{__WARN__} = sub {
+ my $warn = join '', @_;
+ $warn =~ s/\n\r/ /g;
+ print $wtr "!warn : $warn\n";
+ kill SIGUSR1 => $ppid if $ppid;
+ };
+ $SIG{TSTP} = sub {
+ $rcv->reset;
+ kill SIGUSR1 => $ppid if $ppid;
+ };
+ print $wtr "ok\n";
pause while 1;
exit EXIT_FAILURE;
}
- my $ready = 0;
- local $SIG{HUP} = sub { $ready = 1 };
- sleep 1 until $ready;
close $wtr or die "close() failed: $!";
my $oldfh = select $rdr;
$| = 1;
select $oldfh;
+ my $t = <$rdr>;
}
sub slaughter {
close $rdr or die "close() falied: $!";
undef $rdr;
}
- if (defined $pid) {
- kill SIGINT => $pid;
- kill SIGTERM => $pid;
+ if ($pid) {
kill SIGKILL => $pid;
waitpid $pid, 0;
undef $pid;
my $a = (int(100 * (3 * length $msg) / $speed) || 1);
$a = 10 if $a > 10;
alarm $a;
- kill SIGHUP => $pid;
$snd->post($msg);
$snd->speed($speed);
+ $ready = 0;
$snd->send($pid);
+ pause until $ready;
$r = <$rdr>;
alarm 0;
};
if ($r eq $dump) {
$ok = 1;
} else {
- kill SIGHUP => $pid;
+ warn $1 if $r =~ /^warn\s*:\s*(.*)/;
+ $ready = 0;
+ kill SIGTSTP => $pid if $pid;
+ pause until $ready;
}
}
}
my $a = (int(100 * (3 * $l) / $speed) || 1);
$a = 10 if $a > 10;
alarm $a;
- kill SIGHUP => $pid;
$snd->post($msg);
$snd->speed($speed);
+ $ready = 0;
$snd->send($pid);
+ pause until $ready;
$r = <$rdr>;
alarm 0;
};
if ($r eq $dump) {
++$ok;
} else {
- kill SIGHUP => $pid;
+ $ready = 0;
+ kill SIGTSTP => $pid if $pid;
+ pause until $ready;
last TRY;
}
}