| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package IPC::MorseSignals::Receiver; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 10 |  |  | 10 |  | 74403 | use strict; | 
|  | 10 |  |  |  |  | 30 |  | 
|  | 10 |  |  |  |  | 369 |  | 
| 4 | 10 |  |  | 10 |  | 71 | use warnings; | 
|  | 10 |  |  |  |  | 105 |  | 
|  | 10 |  |  |  |  | 415 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 10 |  |  | 10 |  | 65 | use Carp qw; | 
|  | 10 |  |  |  |  | 27 |  | 
|  | 10 |  |  |  |  | 661 |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 | 10 |  |  | 10 |  | 5222 | use Bit::MorseSignals::Receiver; | 
|  | 10 |  |  |  |  | 27429 |  | 
|  | 10 |  |  |  |  | 417 |  | 
| 9 | 10 |  |  | 10 |  | 86 | use base qw; | 
|  | 10 |  |  |  |  | 29 |  | 
|  | 10 |  |  |  |  | 2652 |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | =head1 NAME | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | IPC::MorseSignals::Receiver - Base class for IPC::MorseSignals receivers. | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | =head1 VERSION | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | Version 0.17 | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | =cut | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | our $VERSION = '0.17'; | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | =head1 WARNING | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | Due to the POSIX signals specification (which I wasn't aware of at the time I wrote this module), this module is by nature completely unreliable and will never work properly. | 
| 26 |  |  |  |  |  |  | It is therefore B. | 
| 27 |  |  |  |  |  |  | Please don't use it (if you were actually crazy enough to use it). | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | use IPC::MorseSignals::Receiver; | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | local %SIG; | 
| 34 |  |  |  |  |  |  | my $pants = IPC::MorseSignals::Receiver->new(\%SIG, done => sub { | 
| 35 |  |  |  |  |  |  | print STDERR "GOT $_[1]\n"; | 
| 36 |  |  |  |  |  |  | }); | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | This module installs C<< $SIG{qw} >> handlers and forwards the bits received to an underlying L receiver. | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | =head1 METHODS | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | =head2 C | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | my $imr = IPC::MorseSignals::Receiver->new(%bmr_options); | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | Creates a new receiver object. | 
| 49 |  |  |  |  |  |  | Its arguments are passed to L, in particular the C callback. | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | =cut | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | sub new { | 
| 54 | 4 |  |  | 4 | 1 | 157 | my $class = shift; | 
| 55 | 4 |  |  |  |  | 11 | my $sig   = shift; | 
| 56 | 4 |  | 50 |  |  | 32 | $class = ref $class || $class || return; | 
| 57 | 4 | 50 | 33 |  |  | 31 | croak 'The first argument must be a hash reference to the %SIG hash' | 
| 58 |  |  |  |  |  |  | unless $sig and ref $sig eq 'HASH'; | 
| 59 | 4 |  |  |  |  | 51 | my $self = bless $class->SUPER::new(@_), $class; | 
| 60 | 4 |  |  | 1333 |  | 237 | @{$sig}{qw} = (sub { $self->push(0) }, sub { $self->push(1) }); | 
|  | 4 |  |  |  |  | 89 |  | 
|  | 2320 |  |  |  |  | 16558 |  | 
|  | 1322 |  |  |  |  | 10673 |  | 
| 61 | 4 |  |  |  |  | 28 | return $self; | 
| 62 |  |  |  |  |  |  | } | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | =pod | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | IPC::MorseSignals::Receiver objects also inherit methods from L. | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | =head1 EXPORT | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | An object module shouldn't export any function, and so does this one. | 
| 71 |  |  |  |  |  |  |  | 
| 72 |  |  |  |  |  |  | =head1 DEPENDENCIES | 
| 73 |  |  |  |  |  |  |  | 
| 74 |  |  |  |  |  |  | L. | 
| 75 |  |  |  |  |  |  |  | 
| 76 |  |  |  |  |  |  | L (standard since perl 5) is also required. | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | =head1 SEE ALSO | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  | L, L. | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | L, L, L. | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | L for information about signals in perl. | 
| 85 |  |  |  |  |  |  |  | 
| 86 |  |  |  |  |  |  | For truly useful IPC, search for shared memory, pipes and semaphores. | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | =head1 AUTHOR | 
| 89 |  |  |  |  |  |  |  | 
| 90 |  |  |  |  |  |  | Vincent Pit, C<<  >>, L. | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | You can contact me by mail or on C (vincent). | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  | =head1 BUGS | 
| 95 |  |  |  |  |  |  |  | 
| 96 |  |  |  |  |  |  | Please report any bugs or feature requests to C, or through the web interface at L. | 
| 97 |  |  |  |  |  |  | I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. | 
| 98 |  |  |  |  |  |  |  | 
| 99 |  |  |  |  |  |  | =head1 SUPPORT | 
| 100 |  |  |  |  |  |  |  | 
| 101 |  |  |  |  |  |  | You can find documentation for this module with the perldoc command. | 
| 102 |  |  |  |  |  |  |  | 
| 103 |  |  |  |  |  |  | perldoc IPC::MorseSignals::Receiver | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  | =head1 COPYRIGHT & LICENSE | 
| 106 |  |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  | Copyright 2007,2008,2013,2017 Vincent Pit, all rights reserved. | 
| 108 |  |  |  |  |  |  |  | 
| 109 |  |  |  |  |  |  | This program is free software; you can redistribute it and/or modify it | 
| 110 |  |  |  |  |  |  | under the same terms as Perl itself. | 
| 111 |  |  |  |  |  |  |  | 
| 112 |  |  |  |  |  |  | =cut | 
| 113 |  |  |  |  |  |  |  | 
| 114 |  |  |  |  |  |  | 1; # End of IPC::MorseSignals::Receiver |