Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Is there a cleaner way to do this? I have experimented with File::Tail, but I get the same results.
Any help appreciated.
Regards,
Stacy.
$tpid = open(MLOG,"tail -f $log_dir/mkisofs.log |"); &log("Started mkisofs.log tail: pid = $tpid"); while ($line = <MLOG>) { if ($line =~ /estimate finish/) { $line =~ s/^\s+//; #remove leading whitespace $perc = (split(/\s+/, $line))[0]; chop($perc); #get rid of the "%" $perc = sprintf("%3.0f", $perc); $progress_label -> configure(-text => "Completed: $perc%"); $progress_scale -> set($perc); $main->update; } last if $line =~ /extents written/; } kill('TERM', $tpid); #kill the tail process close(MLOG);
Edit: chipmunk 2001-05-30
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Updating a GUI with tail???
by chb (Deacon) on May 30, 2001 at 11:58 UTC | |
|
Re: Updating a GUI with tail???
by stefan k (Curate) on May 30, 2001 at 13:14 UTC | |
|
Re: Updating a GUI with tail???
by maderman (Beadle) on Jun 12, 2001 at 07:54 UTC |