Advertisement
Guest User

reopen on eof

a guest
Nov 6th, 2016
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 6 0.31 KB | None | 0 0
  1. use v6;
  2. loop {
  3.     my $fh;
  4.     my $s = $*IN.Supply;
  5.     if $*IN.eof {
  6.         say 'reopen';
  7.         $*IN.close;
  8.         $*IN = open($*IN.path, :r);
  9.     }
  10.     react {
  11.         whenever $s -> $buf {
  12.             print $buf;
  13.             LAST {
  14.                 say 'got eof';
  15.             }
  16.         }
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement