IPC::MorseSignals

IPC::MorseSignals is a way to communicate between processes with Morse signals.
Download

IPC::MorseSignals Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Vincent Pit
  • Publisher web site:
  • http://search.cpan.org/~vpit/

IPC::MorseSignals Tags


IPC::MorseSignals Description

IPC::MorseSignals is a way to communicate between processes with Morse signals. IPC::MorseSignals is a way to communicate between processes with Morse signals.SYNOPSIS use IPC::MorseSignals qw/msend mrecv/; my $pid = fork; if (!defined $pid) { die "fork() failed: $!"; } elsif ($pid == 0) { my $s = mrecv local %SIG, cb => sub { print STDERR "received $_ from $_!n"; exit }; 1 while 1; } msend "hello!n" => $pid; waitpid $pid, 0;This module implements a rare form of IPC by sending Morse-like signals through SIGUSR1 and SIGUSR2. Both of those signals are used, so you won't be able to keep them for something else when you use this module.But, seriously, use something else for your IPC.FUNCTIONSmsend msend $msg, $pid Sends the string $msg to the process $pid (or to all the processes @$pid if $pid is an array ref) at $speed bits per second. Default speed is 512, don't set it too low or the target will miss bits and the whole message will be crippled. If the sign flag is unset (default is set), the PID of the sender won't be shipped with the packet. UTF-8 encoded strings are automatically detected. The utf8 bit of the packet message is turned on, so that the receiver can encode them appropriately.mrecv mrecv %SIG Takes as its first argument the %SIG hash and returns a hash reference that represent the current state of the receiver. %SIG's fields 'USR1' and 'USR2' will be replaced by the receiver's callbacks. cb specifies the callback to trigger each time a complete message has arrived. Basically, you want to use it like this : my $rcv = mrecv local %SIG, cb => sub { ... };In the callback, $_ is the sender's PID (or 0 if the sender wanted to stay anonymous) and $_ is the message received.mreset mreset $rcvResets the state of the receiver $rcv. Useful to abort transfers.mbusy mbusy $rcvReturns true if the receiver $rcv is currently busy with incoming data, or false otherwise.mlastsender mlastsender $rcvHolds the PID of the last process that sent data to the receiver $rcv, 0 if that process was anonymous, or undef if no message has arrived yet. It isn't cleared by "mreset".mlastmsg mlastmsg $rcvHolds the last message received by $rcv, or undef if no message has arrived yet. It isn't cleared by "mreset". Requirements: · Perl


IPC::MorseSignals Related Software