IPC::MorseSignals::Receiver - Base class for IPC::MorseSignals receivers.


IPC-MorseSignals documentation Contained in the IPC-MorseSignals distribution.

Index


Code Index:

NAME

Top

IPC::MorseSignals::Receiver - Base class for IPC::MorseSignals receivers.

VERSION

Top

Version 0.15

SYNOPSIS

Top

    use IPC::MorseSignals::Receiver;

    local %SIG;
    my $pants = new IPC::MorseSignals::Receiver \%SIG, done => sub {
     print STDERR "GOT $_[1]\n";
    };

DESCRIPTION

Top

This module installs $SIG{qw/USR1 USR2/} handlers and forwards the bits received to an underlying Bit::MorseSignals receiver.

METHODS

Top

new

Creates a new receiver object. Its arguments are passed to new in Bit::MorseSignals::Receiver, in particular the done callback.

IPC::MorseSignals::Receiver objects also inherit methods from Bit::MorseSignals::Receiver.

EXPORT

Top

An object module shouldn't export any function, and so does this one.

DEPENDENCIES

Top

Bit::MorseSignals::Receiver.

Carp (standard since perl 5) is also required.

SEE ALSO

Top

IPC::MorseSignals, IPC::MorseSignals::Emitter.

Bit::MorseSignals, Bit::MorseSignals::Emitter, Bit::MorseSignals::Receiver.

perlipc for information about signals in perl.

For truly useful IPC, search for shared memory, pipes and semaphores.

AUTHOR

Top

Vincent Pit, <perl at profvince.com>, http://www.profvince.com.

You can contact me by mail or on #perl @ FreeNode (vincent or Prof_Vince).

BUGS

Top

Please report any bugs or feature requests to bug-ipc-morsesignals-receiver at rt.cpan.org, or through the web interface at 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.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc IPC::MorseSignals::Receiver

COPYRIGHT & LICENSE

Top


IPC-MorseSignals documentation Contained in the IPC-MorseSignals distribution.
package IPC::MorseSignals::Receiver;

use strict;
use warnings;

use Carp qw/croak/;

use Bit::MorseSignals::Receiver;
use base qw/Bit::MorseSignals::Receiver/;

our $VERSION = '0.15';

sub new {
 my $class = shift;
 my $sig   = shift;
 $class = ref $class || $class || return;
 croak 'The first argument must be a hash reference to the %SIG hash'
  unless $sig and ref $sig eq 'HASH';
 my $self = bless $class->SUPER::new(@_), $class;
 @{$sig}{qw/USR1 USR2/} = (sub { $self->push(0) }, sub { $self->push(1) });
 return $self;
}

1; # End of IPC::MorseSignals::Receiver