From: Chris Nehren Date: Sun, 19 Aug 2012 01:57:35 +0000 (+0000) Subject: add some debugging X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8a706e6ca0d5da93c49d13c487b3024b0c4c1bba;p=scpubgit%2FObject-Remote.git add some debugging --- diff --git a/lib/Object/Remote/Future.pm b/lib/Object/Remote/Future.pm index 893fb6d..23a9441 100644 --- a/lib/Object/Remote/Future.pm +++ b/lib/Object/Remote/Future.pm @@ -8,6 +8,8 @@ use CPS::Future; our @EXPORT = qw(future await_future await_all); +sub _log { printf "[%s] %s\n", scalar(localtime), join '', @_ } + sub future (&;$) { my $f = $_[0]->(CPS::Future->new); return $f if ((caller(1+($_[1]||0))||'') eq 'start'); @@ -18,6 +20,7 @@ our @await; sub await_future { my $f = shift; + _log(sprintf "got $f: [%s]", $f->is_ready); return $f if $f->is_ready; require Object::Remote; my $loop = Object::Remote->current_loop; diff --git a/lib/Object/Remote/MiniLoop.pm b/lib/Object/Remote/MiniLoop.pm index 3951bf9..3a5b763 100644 --- a/lib/Object/Remote/MiniLoop.pm +++ b/lib/Object/Remote/MiniLoop.pm @@ -16,6 +16,8 @@ has _write_select => (is => 'ro', default => sub { IO::Select->new }); has _timers => (is => 'ro', default => sub { [] }); +sub _log { shift; printf "[%s] %s\n", scalar(localtime), join '', @_ } + sub pass_watches_to { my ($self, $new_loop) = @_; foreach my $fh ($self->_read_select->handles) { @@ -90,6 +92,7 @@ sub loop_once { # differentiate between an error and a timeout. # -- no, love, mst. foreach my $fh (@$readable) { + $self->_log("got a readable: $fh"); $read->{$fh}() if $read->{$fh}; } foreach my $fh (@$writeable) {