I'm having some trouble using the progress bar for the first time. I'm running a copy in a thread and once everything else completes I want to monitor the progress. The example snippets I gave result in the bar completing @ 5%.#!/usr/bin/perl use threads; use threads::shared; use Term::ProgressBar; ${$task . '_src_filesize'}; share(${$task . '_src_filesize'}); ${$task . '_dst_filesize'}; share(${$task . '_dst_filesize'}); # fork copy to a new thread, so it runs in the background ${'copy_' . $task . '_thread'} = threads->create(sub { print "Copying: $task/dist/$task.zip to /mnt/nfs/$task/$rel.zip\n" +; system("cp $task/dist/$task.zip /mnt/nfs/$task/$rel.zip"); while (${$task . '_src_filesize'} != ${$task . '_dst_filesize'} ) +{ ${$task . '_dst_filesize'} = stat("/mnt/nfs/$task/$rel.zip")-> +size; } if (-e "/mnt/nfs/$task/$rel.zip") { print "Copied: $task/dist/$task.zip to /mnt/nfs/$task/$rel.zip +\n"; unlink("$task/dist/$task.zip"); } }); $progress = Term::ProgressBar->new({ name => 'Copy', count => ${$task . '_src_filesize'}, ETA => 'linear', }); $progress->minor(0); while (${$task . '_src_filesize'} != ${$task . '_dst_filesize'}) { $progress->update(${$task . '_dst_filesize'}) }
In reply to Term::Progress bar completes at 5% by aramsey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |