]> git.vpit.fr Git - perl/modules/IPC-MorseSignals.git/blobdiff - samples/tryityourself.pl
Importing IPC-MorseSignals-0.06.tar.gz
[perl/modules/IPC-MorseSignals.git] / samples / tryityourself.pl
index 8e645107b5a7a7f1edb54ef7acb2ecb623b50479..3e7dfa74a80d1d057bfd46bc8a1e2b82c762c478 100755 (executable)
@@ -11,10 +11,15 @@ my $pid = fork;
 if (!defined $pid) {
  die "fork() failed : $!";
 } elsif ($pid == 0) {
- local @SIG{qw/USR1 USR2/} = mrecv sub { print STDERR "recieved: $_[0]"; exit };
- print STDERR "child wait for data...\n";
+ my $s = mrecv local %SIG, cb => sub {
+  print STDERR "I, the child, recieved this from $_[0]: $_[1]\n";
+  exit
+ };
+ print STDERR "I'm $$ (the child), and I'm waiting for data...\n";
  1 while 1;
 }
 
-msend "This message was sent with IPC::MorseSignals\n" => $pid;
+print STDERR "I'm $$ (the father), and I'm gonna send a message to my child $pid.\n";
+
+msend "This message was sent with IPC::MorseSignals" => $pid;
 waitpid $pid, 0;