line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package IPC::MorseSignals::Receiver; |
2
|
|
|
|
|
|
|
|
3
|
10
|
|
|
10
|
|
30355
|
use strict; |
|
10
|
|
|
|
|
21
|
|
|
10
|
|
|
|
|
330
|
|
4
|
10
|
|
|
10
|
|
50
|
use warnings; |
|
10
|
|
|
|
|
71
|
|
|
10
|
|
|
|
|
255
|
|
5
|
|
|
|
|
|
|
|
6
|
10
|
|
|
10
|
|
48
|
use Carp qw/croak/; |
|
10
|
|
|
|
|
21
|
|
|
10
|
|
|
|
|
541
|
|
7
|
|
|
|
|
|
|
|
8
|
10
|
|
|
10
|
|
8127
|
use Bit::MorseSignals::Receiver; |
|
10
|
|
|
|
|
33849
|
|
|
10
|
|
|
|
|
356
|
|
9
|
10
|
|
|
10
|
|
62
|
use base qw/Bit::MorseSignals::Receiver/; |
|
10
|
|
|
|
|
18
|
|
|
10
|
|
|
|
|
1989
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
IPC::MorseSignals::Receiver - Base class for IPC::MorseSignals receivers. |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 VERSION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Version 0.16 |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our $VERSION = '0.16'; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 SYNOPSIS |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use IPC::MorseSignals::Receiver; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
local %SIG; |
28
|
|
|
|
|
|
|
my $pants = IPC::MorseSignals::Receiver->new(\%SIG, done => sub { |
29
|
|
|
|
|
|
|
print STDERR "GOT $_[1]\n"; |
30
|
|
|
|
|
|
|
}); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 DESCRIPTION |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
This module installs C<$SIG{qw/USR1 USR2/}> handlers and forwards the bits received to an underlying L receiver. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 METHODS |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 C |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Creates a new receiver object. Its arguments are passed to L, in particular the C callback. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub new { |
45
|
4
|
|
|
4
|
1
|
50
|
my $class = shift; |
46
|
4
|
|
|
|
|
9
|
my $sig = shift; |
47
|
4
|
|
50
|
|
|
34
|
$class = ref $class || $class || return; |
48
|
4
|
50
|
33
|
|
|
34
|
croak 'The first argument must be a hash reference to the %SIG hash' |
49
|
|
|
|
|
|
|
unless $sig and ref $sig eq 'HASH'; |
50
|
4
|
|
|
|
|
45
|
my $self = bless $class->SUPER::new(@_), $class; |
51
|
4
|
|
|
1327
|
|
197
|
@{$sig}{qw/USR1 USR2/} = (sub { $self->push(0) }, sub { $self->push(1) }); |
|
4
|
|
|
|
|
187
|
|
|
2315
|
|
|
|
|
13006
|
|
|
1327
|
|
|
|
|
8413
|
|
52
|
4
|
|
|
|
|
16
|
return $self; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=pod |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
IPC::MorseSignals::Receiver objects also inherit methods from L. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 EXPORT |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
An object module shouldn't export any function, and so does this one. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
L. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
L (standard since perl 5) is also required. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 SEE ALSO |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
L, L. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
L, L, L. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
L for information about signals in perl. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
For truly useful IPC, search for shared memory, pipes and semaphores. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 AUTHOR |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Vincent Pit, C<< >>, L. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
You can contact me by mail or on C (vincent). |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 BUGS |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
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. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 SUPPORT |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
perldoc IPC::MorseSignals::Receiver |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Copyright 2007,2008,2013 Vincent Pit, all rights reserved. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
100
|
|
|
|
|
|
|
under the same terms as Perl itself. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=cut |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
1; # End of IPC::MorseSignals::Receiver |