in reply to Reading a file live!
How can i do this without blocking my master script?
see Proc::Background and Poll :) non-blocking is called polling
for example
use Proc::Background; my $proc1 = Proc::Background->new($command, $arg1, $arg2); while( 1 ){ sleep 1; my $newsize = -s $fhorfilename; # if( ( $newsize - $oldsize ) > $minimum ){ if( ( $newsize - $oldsize ) > $buffersize ){ } my $readed = read $fh, $buffer, $buffersize; doStuff( $readed , $fh, $buffer, $buffersize ); ... last if not $proc1->alive; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Reading a file live! (poll)
by negativ_m (Novice) on Mar 07, 2014 at 08:24 UTC | |
by hippo (Archbishop) on Mar 07, 2014 at 08:38 UTC | |
by negativ_m (Novice) on Mar 07, 2014 at 08:47 UTC | |
by Anonymous Monk on Mar 07, 2014 at 08:37 UTC | |
by negativ_m (Novice) on Mar 07, 2014 at 08:51 UTC |