| 1 | package POEx::IRC::Backend::Role::HasWheel; | ||
| 2 | 4 | $POEx::IRC::Backend::Role::HasWheel::VERSION = '0.030002'; | |
| 3 | 4 | ▶ | use Types::Standard -all; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 4 | ▶ | use Moo::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | has wheel_id => ( | ||
| 8 | # lazy but set by trigger in ->wheel: | ||
| 9 | lazy => 1, | ||
| 10 | isa => Defined, | ||
| 11 | is => 'ro', | ||
| 12 | writer => '_set_wheel_id', | ||
| 13 | 0 | ▶ | builder => sub { shift->wheel->ID }, |
|
Subroutine
_build_wheel_id: not called CC=1 SCAR=6.9
| |||
| 14 | 4 | ); | |
| 15 | |||
| 16 | has wheel => ( | ||
| 17 | required => 1, | ||
| 18 | isa => Maybe[ InstanceOf['POE::Wheel'] ], | ||
| 19 | is => 'ro', | ||
| 20 | clearer => 'clear_wheel', | ||
| 21 | writer => 'set_wheel', | ||
| 22 | predicate => 'has_wheel', | ||
| 23 | trigger => sub { | ||
| 24 | 8 | ▶ | my ($self, $wheel) = @_; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 25 | 8 | $self->_set_wheel_id( $wheel->ID ) | |
| 26 | }, | ||
| 27 | 4 | ); | |
| 28 | |||
| 29 | 4 | 1; | |
| 30 | |||
| 31 | =pod | ||
| 32 | |||
| 33 | =for Pod::Coverage has_\w+ | ||
| 34 | |||
| 35 | =head1 NAME | ||
| 36 | |||
| 37 | POEx::IRC::Backend::Role::HasWheel | ||
| 38 | |||
| 39 | =head1 DESCRIPTION | ||
| 40 | |||
| 41 | =head2 wheel | ||
| 42 | |||
| 43 | A L<POE::Wheel> instance; typically L<POE::Wheel::SocketFactory> for | ||
| 44 | L<POEx::IRC::Backend::Listener> and L<POEx::IRC::Backend::Connector> objects, | ||
| 45 | or L<POE::Wheel::ReadWrite> for live L<POEx::IRC::Backend::Connect> objects. | ||
| 46 | |||
| 47 | This is primarily for internal use. B<< External code should not interact | ||
| 48 | directly with the C<wheel>; >> doing so may result in misdelivered events and | ||
| 49 | other unexpected behavior. | ||
| 50 | |||
| 51 | Clearer: B<clear_wheel> | ||
| 52 | |||
| 53 | Predicate: B<has_wheel> | ||
| 54 | |||
| 55 | Writer: B<set_wheel> | ||
| 56 | |||
| 57 | =head2 wheel_id | ||
| 58 | |||
| 59 | The POE ID of the last known L</wheel>. | ||
| 60 | |||
| 61 | =head1 AUTHOR | ||
| 62 | |||
| 63 | Jon Portnoy <avenj@cobaltirc.org> | ||
| 64 | |||
| 65 | =cut | ||