ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/Coro/Debug.pm
(Generate patch)

Comparing Coro/Coro/Debug.pm (file contents):
Revision 1.78 by root, Fri May 29 07:01:18 2009 UTC vs.
Revision 1.79 by root, Wed Jun 17 03:45:34 2009 UTC

118 118
119use Coro (); 119use Coro ();
120use Coro::Handle (); 120use Coro::Handle ();
121use Coro::State (); 121use Coro::State ();
122use Coro::AnyEvent (); 122use Coro::AnyEvent ();
123use Coro::Timer ();
123 124
124our $VERSION = 5.132; 125our $VERSION = 5.132;
125 126
126our %log; 127our %log;
127our $SESLOGLEVEL = exists $ENV{PERL_CORO_DEFAULT_LOGLEVEL} ? $ENV{PERL_CORO_DEFAULT_LOGLEVEL} : -1; 128our $SESLOGLEVEL = exists $ENV{PERL_CORO_DEFAULT_LOGLEVEL} ? $ENV{PERL_CORO_DEFAULT_LOGLEVEL} : -1;
421 last; 422 last;
422 423
423 } elsif ($cmd =~ /^(?:ll|loglevel)\s*(\d+)?\s*/) { 424 } elsif ($cmd =~ /^(?:ll|loglevel)\s*(\d+)?\s*/) {
424 $loglevel = defined $1 ? $1 : -1; 425 $loglevel = defined $1 ? $1 : -1;
425 426
427 } elsif ($cmd =~ /^(?:w|watch)\s*([0-9.]*)\s+(.*)/) {
428 my ($time, $cmd) = ($1*1 || 1, $2);
429 my $cancel;
430
431 Coro::async {
432 $Coro::current->{desc} = "watch $cmd";
433 select $fh;
434 until ($cancel) {
435 command $cmd;
436 Coro::Timer::sleep $time;
437 }
438 };
439
440 $fh->readable;
441 $cancel = 1;
442
426 } elsif ($cmd =~ /^help\s*/) { 443 } elsif ($cmd =~ /^help\s*/) {
427 command $cmd; 444 command $cmd;
428 print <<EOF; 445 print <<EOF;
429loglevel <int> enable logging for messages of level <int> and lower 446loglevel <int> enable logging for messages of level <int> and lower
447watch <time> <command> repeat the given command until STDIN becomes readable
430exit end this session 448exit end this session
431EOF 449EOF
432 } else { 450 } else {
433 command $cmd; 451 command $cmd;
434 } 452 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines