Skip to content

Commit

Permalink
use a more realistic reactor example
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 10, 2017
1 parent 2e62848 commit 6196804
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Mojo/IOLoop.pm
Expand Up @@ -359,16 +359,16 @@ L<Mojo::Reactor::EV> object with a default subscriber to the event
L<Mojo::Reactor/"error">.
# Watch if handle becomes readable or writable
$loop->reactor->io($handle => sub {
Mojo::IOLoop->singleton->reactor->io($handle => sub {
my ($reactor, $writable) = @_;
say $writable ? 'Handle is writable' : 'Handle is readable';
});
# Change to watching only if handle becomes writable
$loop->reactor->watch($handle, 0, 1);
Mojo::IOLoop->singleton->reactor->watch($handle, 0, 1);
# Remove handle again
$loop->reactor->remove($handle);
Mojo::IOLoop->singleton->reactor->remove($handle);
=head1 METHODS
Expand Down

0 comments on commit 6196804

Please sign in to comment.