sub loop { my $self = shift; while(my @ready = $self->{_selector}->can_read) { foreach my $fh (@ready) { if($fh == $self->{_listener}) { $self->accept_connection(); } else { $self->handle_data($fh); } } } }