Hi Dave. That routine was great. Took the guts from it and ended up with below. Im having a wee problem getting my head around printf( as in it would be good to be able to have each information on a new line, but using formatters \r overwrites a line and \n because its re-entrant just scrolls each time it enters. So Ive ended up with a single line:
#Hook information subroutine
use Hook::WrapSub qw(wrap_subs);
use IO::Handle;
use Time::HiRes qw(gettimeofday);
my $t0 = gettimeofday( );
my $FDcount = 0;
sub after_dircopy {
my $t1 = gettimeofday( );
my $elapsed = $t1 - $t0;
printf("\rElapsed time since start: H%02d:M%02d:S%02d Number of files
+and directories processed: %02d Ctrl-C breaks",
($t1 - $t0) / (60*60),
($t1 - $t0) / ( 60) % 60,
($t1 - $t0) % 60,
++$FDcount);
STDOUT->flush;
}
wrap_subs sub {}, 'File::Copy::Recursive::fcopy',\&after_dircopy;
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|