Hacker News new | past | comments | ask | show | jobs | submit login

From pages 56 and 57:

> Perl 6 has an asynchronous looping construct called whenever ... runs whenever a value arrives ... can live in a ... react block (works like entering an event loop)

  my $code = supply {
    whenever IO::Notification.watch-path($src-dir) {
      emit .path if .path ~~ /<.pm .p6> $/;
    }
  }
So now, whenever something in $src-dir changes and its path ends with '.pm' or '.p6' that path will be emitted -- which in this case means it'll be pushed to any construct pulling from $code. Such as:

  react {
    whenever $code -> $path {
      say "Code file $path changed!";
    }
  }



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: