line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package IPC::MorseSignals; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
19021
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
54
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
56
|
|
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 and C. 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 L is a base class for emitters ; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=item L is a base class for receivers. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=back |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
But, seriously, use something else for your IPC. :) |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 CAVEATS |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
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. |
54
|
|
|
|
|
|
|
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. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
You need the complete L distribution. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
L (standard since perl 5), L (idem) and L (since perl 5.7.3) are also required. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 SEE ALSO |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
L, L. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
L, L, L. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
L for information about signals in perl. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
For truly useful IPC, search for shared memory, pipes and semaphores. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 AUTHOR |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Vincent Pit, C<< >>, L. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
You can contact me by mail or on C (vincent). |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 BUGS |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through the web interface at L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 SUPPORT |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
perldoc IPC::MorseSignals |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Thanks for the inspiration, mofino ! I hope this module will fill all your IPC needs. :) |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Copyright 2007,2008,2013 Vincent Pit, all rights reserved. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
97
|
|
|
|
|
|
|
under the same terms as Perl itself. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=cut |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
1; # End of IPC::MorseSignals |