]> git.vpit.fr Git - perl/modules/IPC-MorseSignals.git/blob - lib/IPC/MorseSignals.pm
13a6d2fe30f5b27b32c66516703790617e25d845
[perl/modules/IPC-MorseSignals.git] / lib / IPC / MorseSignals.pm
1 package IPC::MorseSignals;
2
3 use strict;
4 use warnings;
5
6 =head1 NAME
7
8 IPC::MorseSignals - Communicate between processes with Morse signals.
9
10 =head1 VERSION
11
12 Version 0.16
13
14 =cut
15
16 our $VERSION = '0.16';
17
18 =head1 SYNOPSIS
19
20     # In the sender process
21     use IPC::MorseSignals::Emitter;
22
23     my $deuce = IPC::MorseSignals::Emitter->new(speed => 1024);
24     $deuce->post('HLAGH') for 1 .. 3;
25     $deuce->send($pid);
26
27     ...
28
29     # In the receiver process
30     use IPC::MorseSignals::Receiver;
31
32     local %SIG;
33     my $pants = IPC::MorseSignals::Receiver->new(\%SIG, done => sub {
34      print STDERR "GOT $_[1]\n";
35     });
36
37 =head1 DESCRIPTION
38
39 This module implements a rare form of IPC by sending Morse-like signals through C<SIGUSR1> and C<SIGUSR2>. Both of those signals are used, so you won't be able to keep them for something else when you use this module.
40
41 =over 4
42
43 =item *
44
45 L<IPC::MorseSignals::Emitter> is a base class for emitters ;
46
47 =item *
48
49 L<IPC::MorseSignals::Receiver> is a base class for receivers.
50
51 =back
52
53 But, seriously, use something else for your IPC. :)
54
55 =head1 CAVEATS
56
57 When the same signal is sent several times in a row to a process, the POSIX standard does not guarantee that the relevant signal handler will be called for each of the notifications.
58 This will result in malformed messages if the transfer speed is so high that the operating system does not have the time to call the signal handler for each bit.
59
60 =head1 DEPENDENCIES
61
62 You need the complete L<Bit::MorseSignals> distribution.
63
64 L<Carp> (standard since perl 5), L<POSIX> (idem) and L<Time::HiRes> (since perl 5.7.3) are also required.
65
66 =head1 SEE ALSO
67
68 L<IPC::MorseSignals::Emitter>, L<IPC::MorseSignals::Receiver>.
69
70 L<Bit::MorseSignals>, L<Bit::MorseSignals::Emitter>, L<Bit::MorseSignals::Receiver>.
71
72 L<perlipc> for information about signals in perl.
73
74 For truly useful IPC, search for shared memory, pipes and semaphores.
75
76 =head1 AUTHOR
77
78 Vincent Pit, C<< <perl at profvince.com> >>, L<http://www.profvince.com>.
79
80 You can contact me by mail or on C<irc.perl.org> (vincent).
81
82 =head1 BUGS
83
84 Please report any bugs or feature requests to C<bug-ipc-morsesignals at rt.cpan.org>, or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=IPC-MorseSignals>.  I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
85
86 =head1 SUPPORT
87
88 You can find documentation for this module with the perldoc command.
89
90     perldoc IPC::MorseSignals
91
92 =head1 ACKNOWLEDGEMENTS
93
94 Thanks for the inspiration, mofino ! I hope this module will fill all your IPC needs. :)
95
96 =head1 COPYRIGHT & LICENSE
97
98 Copyright 2007,2008,2013 Vincent Pit, all rights reserved.
99
100 This program is free software; you can redistribute it and/or modify it
101 under the same terms as Perl itself.
102
103 =cut
104
105 1; # End of IPC::MorseSignals