Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: A whirleygig for a progress indicator for scripts

by Wire64 (Initiate)
on May 16, 2009 at 17:42 UTC ( #764432=note: print w/replies, xml ) Need Help??


in reply to Re: RE: A whirleygig for a progress indicator for scripts
in thread A whirleygig for a progress indicator for scripts

Is there anyway i can use Whirley with File::Copy ?

I want to show a progress meter (percentage) while moving a file.
I found http://www.perlmonks.org/?node=File%20copy%20progress. but that doesn't use File::Copy and dont know if it working for large files.
Or can i do something like;

my $sizetarget= (-s $destination); my $sizesource= (-s $source); my $percentage=""; while (move($source,$destination) || print "$!\n") { $sizetarget = (-s $destination); $percentage = ($sizetarget / $sizesource)*100; print "[$percentage\%]\r"; }
hmm nope that doesnt work.. anyways you get my point.
Hope anyone can give me an example or a hand :).
greets,
Wire64

Replies are listed 'Best First'.
Re^4: A whirleygig for a progress indicator for scripts
by Corion (Pope) on May 16, 2009 at 17:50 UTC

    No. From looking at the File::Copy source code, it provides no progress callback. You could try to override CORE::sysread and/or CORE::syswrite, which File::Copy uses in its inner loop. Or just do the progress based on the number of files.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://764432]
help
Chatterbox?
[Corion]: Ah. The magic invocation is set PERL5OPT=-M-lib=. (equivalent of no lib '.';
[Corion]: )
[Corion]: dazz: BTW, the following should work (no Image::Magick installed, so untested): open(my $fh, '<', \$jpegbuffer); $image->Read(file= > $fh);

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (11)
As of 2017-03-27 08:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (317 votes). Check out past polls.