| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | package POE::Component::Supervisor::Supervised::Session; | ||
| 4 | 12 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 12 | ▶ | use POE::Component::Supervisor::Handle::Session; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 12 | ▶ | use namespace::clean -except => 'meta'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 12 | with qw(POE::Component::Supervisor::Supervised); | |
| 11 | |||
| 12 | 12 | has '+handle_class' => ( default => "POE::Component::Supervisor::Handle::Session" ); | |
| 13 | |||
| 14 | 12 | __PACKAGE__->_inherit_attributes_from_handle_class; | |
| 15 | |||
| 16 | sub is_abnormal_exit { | ||
| 17 | 47 | ▶ | my ( $self, %args ) = @_; |
|
Subroutine
is_abnormal_exit: called CC=1 SCAR=0.0
Pod
documented
| |||
| 18 | 47 | exists $args{error}; | |
| 19 | } | ||
| 20 | |||
| 21 | 12 | __PACKAGE__ | |
| 22 | |||
| 23 | __END__ | ||
| 24 | |||
| 25 | =pod | ||
| 26 | |||
| 27 | =head1 NAME | ||
| 28 | |||
| 29 | POE::Component::Supervisor::Supervised::Session - Helps | ||
| 30 | L<POE::Component::Supervisor> babysit POE sessions. | ||
| 31 | |||
| 32 | =head1 SYNOPSIS | ||
| 33 | |||
| 34 | POE::Component::Supervisor::Supervised::Session->new( | ||
| 35 | start_callback => sub { | ||
| 36 | return POE::Session->new( | ||
| 37 | |||
| 38 | ); | ||
| 39 | }, | ||
| 40 | ); | ||
| 41 | |||
| 42 | POE::Component::Supervisor::Supervised::Session->new( | ||
| 43 | implicit_tracking => 1, # any sessions from _child create events | ||
| 44 | start_callback => sub { | ||
| 45 | POE::Component::Foo->spawn( | ||
| 46 | ... | ||
| 47 | ); | ||
| 48 | }, | ||
| 49 | ); | ||
| 50 | |||
| 51 | =head1 DESCRIPTION | ||
| 52 | |||
| 53 | This is a factory object that creates L<POE::Component::Supervisor::Handle::Session> objects. | ||
| 54 | |||
| 55 | =head1 ATTRIBUTES | ||
| 56 | |||
| 57 | See also L<POE::Component::Supervisor::Handle::Session/ATTRIBUTES>, all of the | ||
| 58 | documented attributes that apply to handle creation are borrowed by this class. | ||
| 59 | |||
| 60 | =over 4 | ||
| 61 | |||
| 62 | =item handle_class | ||
| 63 | |||
| 64 | The class to instantiate. | ||
| 65 | |||
| 66 | Defaults to L<POE::Component::Supervisor::Handle::Session>. | ||
| 67 | |||
| 68 | Note that attributes are inherited only from | ||
| 69 | L<POE::Component::Supervisor::Handle::Session>. If your handle class requires | ||
| 70 | additional attributes, you must subclass your own C<Supervised> variant. | ||
| 71 | |||
| 72 | The C<_inherit_attributes_from_handle_class> method can then be invoked on your | ||
| 73 | subclass to reinherit all the attributes. Read the source of | ||
| 74 | L<POE::Component::Supervisor::Supervised> for more details. | ||
| 75 | |||
| 76 | =back | ||
| 77 | |||
| 78 | =head1 METHODS | ||
| 79 | |||
| 80 | See also L<POE::Component::Supervisor::Supervised/METHODS>. | ||
| 81 | |||
| 82 | =over 4 | ||
| 83 | |||
| 84 | =item spawn | ||
| 85 | |||
| 86 | Called by L<POE::Component::Supervisor> when a new instance of the child | ||
| 87 | process should be spawned. | ||
| 88 | |||
| 89 | =item is_abnormal_exit | ||
| 90 | |||
| 91 | Used by C<should_restart>. See L<POE::Component::Supervisor::Supervised> for | ||
| 92 | details. | ||
| 93 | |||
| 94 | Returns true if the C<error> argument is provided (it's added by the handle | ||
| 95 | when a C<DIE> signal is cought from one of the tracked sessions). | ||
| 96 | |||
| 97 | =back | ||
| 98 | |||
| 99 | =cut | ||
| 100 | |||
| 101 | |||
| 102 | |||