| 1 | package POE::Component::Supervisor::Handle; | ||||||||||
| 2 | |||||||||||
| 3 | 26 | our $VERSION = '0.09'; | |||||||||
| 4 | |||||||||||
| 5 | 26 | ▶ | use Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 26 | ▶ | use POE::Component::Supervisor::Interface (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 26 | ▶ | use POE::Component::Supervisor::Supervised (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 26 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 26 | with qw(POE::Component::Supervisor::Handle::Interface); | |||||||||
| 11 | |||||||||||
| 12 | 26 | has child => ( | |||||||||
| 13 | does => "POE::Component::Supervisor::Supervised", | ||||||||||
| 14 | is => "ro", | ||||||||||
| 15 | required => 1, | ||||||||||
| 16 | ); | ||||||||||
| 17 | |||||||||||
| 18 | 26 | has supervisor => ( | |||||||||
| 19 | does => "POE::Component::Supervisor::Interface", | ||||||||||
| 20 | is => "rw", | ||||||||||
| 21 | weak_ref => 1, | ||||||||||
| 22 | required => 1, | ||||||||||
| 23 | handles => [qw(notify_spawned notify_stopped)], | ||||||||||
| 24 | ); | ||||||||||
| 25 | |||||||||||
| 26 | 26 | has spawned => ( | |||||||||
| 27 | isa => "Bool", | ||||||||||
| 28 | is => "rw", | ||||||||||
| 29 | writer => "_spawned", | ||||||||||
| 30 | ); | ||||||||||
| 31 | |||||||||||
| 32 | 26 | has stopped => ( | |||||||||
| 33 | isa => "Bool", | ||||||||||
| 34 | is => "rw", | ||||||||||
| 35 | writer => "_stopped", | ||||||||||
| 36 | ); | ||||||||||
| 37 | |||||||||||
| 38 | 26 | has [map { "${_}_callback" } qw(spawned stopped)] => ( | |||||||||
| 39 | isa => "CodeRef", | ||||||||||
| 40 | is => "rw", | ||||||||||
| 41 | required => 0, | ||||||||||
| 42 | ); | ||||||||||
| 43 | |||||||||||
| 44 | 781 | ▶ | sub stop_for_restart { shift->stop(@_) } | ||||||||
|
Subroutine
stop_for_restart: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 45 | |||||||||||
| 46 | 1933 | ▶ | sub notify_spawn { | ||||||||
|
Subroutine
notify_spawn: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 47 | 1933 | my ( $self, @args ) = @_; | |||||||||
| 48 | |||||||||||
| 49 | 1933 | $self->_spawned(1); | |||||||||
| 50 | |||||||||||
| 51 | 1933 | $self->notify_spawned( $self->child, @args); | |||||||||
| 52 | |||||||||||
| 53 | 1933 | ▶ | if ( my $cb = $self->spawned_callback ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 54 | 1 | $self->$cb(@args); | |||||||||
| 55 | } | ||||||||||
| 56 | } | ||||||||||
| 57 | |||||||||||
| 58 | 1879 | ▶ | sub notify_stop { | ||||||||
|
Subroutine
notify_stop: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 59 | 1879 | my ( $self, @args ) = @_; | |||||||||
| 60 | |||||||||||
| 61 | 1879 | $self->_stopped(1); | |||||||||
| 62 | |||||||||||
| 63 | 1879 | $self->notify_stopped( $self->child, @args); | |||||||||
| 64 | |||||||||||
| 65 | 1879 | ▶ | if ( my $cb = $self->stopped_callback ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 66 | 12 | $self->$cb(@args); | |||||||||
| 67 | } | ||||||||||
| 68 | } | ||||||||||
| 69 | |||||||||||
| 70 | 26 | __PACKAGE__ | |||||||||
| 71 | |||||||||||
| 72 | __END__ | ||||||||||