| 1 | package BeamX::Peer::Listener; | ||
| 2 | |||
| 3 | 2 | ▶ | use Types::Standard ':all'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 2 | our $VERSION = '0.003'; | |
| 7 | |||
| 8 | 2 | extends 'Beam::Listener'; | |
| 9 | |||
| 10 | #pod =attr peer | ||
| 11 | #pod | ||
| 12 | #pod An optional reference to a peer object, allowing the emitter to | ||
| 13 | #pod send it an event directly using L<BeamX::Emitter::send>. The | ||
| 14 | #pod object must consume the B<BeamX::Emitter> role. | ||
| 15 | #pod | ||
| 16 | #pod =cut | ||
| 17 | |||
| 18 | #pod =method has_peer | ||
| 19 | #pod | ||
| 20 | #pod $bool = $self->has_peer(); | ||
| 21 | #pod | ||
| 22 | #pod This returns true if the object's peer attribute has been set | ||
| 23 | #pod | ||
| 24 | #pod =cut | ||
| 25 | |||
| 26 | 2 | has peer => ( | |
| 27 | is => 'ro', | ||
| 28 | weak_ref => 1, | ||
| 29 | isa => ConsumerOf ['BeamX::Peer::Emitter'], | ||
| 30 | predicate => 1 | ||
| 31 | ); | ||
| 32 | |||
| 33 | 2 | 1; | |
| 34 | |||
| 35 | # | ||
| 36 | # This file is part of BeamX-Peer-Emitter | ||
| 37 | # | ||
| 38 | # This software is Copyright (c) 2016 by the Smithsonian Astrophysical Observatory. | ||
| 39 | # | ||
| 40 | # This is free software, licensed under: | ||
| 41 | # | ||
| 42 | # The GNU General Public License, Version 3, June 2007 | ||
| 43 | # | ||
| 44 | |||
| 45 | =pod | ||
| 46 | |||
| 47 | =encoding UTF-8 | ||
| 48 | |||
| 49 | =head1 NAME | ||
| 50 | |||
| 51 | BeamX::Peer::Listener | ||
| 52 | |||
| 53 | =head1 VERSION | ||
| 54 | |||
| 55 | version 0.003 | ||
| 56 | |||
| 57 | =head1 SYNOPSIS | ||
| 58 | |||
| 59 | # optional peer | ||
| 60 | %args = ( peer => $peer ); | ||
| 61 | $emitter->subscribe( $event_name, $subref, %args ); | ||
| 62 | |||
| 63 | =head1 DESCRIPTION | ||
| 64 | |||
| 65 | This is the default Listener object created by the | ||
| 66 | L<BeamX::Emitter::subscribe> method when a callback subscription is | ||
| 67 | registered. It sub-classes L<Beam::Listener>. | ||
| 68 | |||
| 69 | =head1 ATTRIBUTES | ||
| 70 | |||
| 71 | =head2 peer | ||
| 72 | |||
| 73 | An optional reference to a peer object, allowing the emitter to | ||
| 74 | send it an event directly using L<BeamX::Emitter::send>. The | ||
| 75 | object must consume the B<BeamX::Emitter> role. | ||
| 76 | |||
| 77 | =head1 METHODS | ||
| 78 | |||
| 79 | =head2 has_peer | ||
| 80 | |||
| 81 | $bool = $self->has_peer(); | ||
| 82 | |||
| 83 | This returns true if the object's peer attribute has been set | ||
| 84 | |||
| 85 | =head1 AUTHOR | ||
| 86 | |||
| 87 | Diab Jerius <djerius@cpan.org> | ||
| 88 | |||
| 89 | =head1 COPYRIGHT AND LICENSE | ||
| 90 | |||
| 91 | This software is Copyright (c) 2016 by the Smithsonian Astrophysical Observatory. | ||
| 92 | |||
| 93 | This is free software, licensed under: | ||
| 94 | |||
| 95 | The GNU General Public License, Version 3, June 2007 | ||
| 96 | |||
| 97 | =cut | ||
| 98 | |||
| 99 | __END__ | ||