sub endpoint_dead { my ($kernel, $heap, $wheel_id) = @_[KERNEL, HEAP, ARG0]; $kernel->post('MAIN-Logger', 'alert', "Endpoint managed by wheel $wheel_id died\n"); my $self = $heap->{self}; # find the wheel and restart endpoint foreach(0..$#{@{$self->{endpoints}}}){ my $wheel = $self->{wheels}->[$_]; my $pname = $self->{endpoints}->[$_]; if($wheel->ID == $wheel_id){ [...] #### # find the wheel and restart endpoint my $i = 0; foreach(@{$self->{endpoints}){ my $pname = $_; my $wheel = $self->{wheels}->[$i]; [...] $i++; }