X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FBenchmark.pm;h=d7e34f88a68bed66234c4f98438d8e7b72b77e5f;hb=14be35aaf1e66d9ee3b0b434256386e605d6024d;hp=3d154bc3214c7c47eee19808ec38d2d341bfeb9a;hpb=53aa2791f2814657eac3bbbec321e82f3209ae86;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/Benchmark.pm b/lib/Benchmark.pm index 3d154bc..d7e34f8 100644 --- a/lib/Benchmark.pm +++ b/lib/Benchmark.pm @@ -432,7 +432,7 @@ our(@ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS, $VERSION); clearcache clearallcache disablecache enablecache); %EXPORT_TAGS=( all => [ @EXPORT, @EXPORT_OK ] ) ; -$VERSION = 1.051; +$VERSION = 1.052; # --- ':hireswallclock' special handling @@ -440,7 +440,7 @@ my $hirestime; sub mytime () { time } -&init; +init(); sub BEGIN { if (eval 'require Time::HiRes') { @@ -470,8 +470,8 @@ sub init { # The cache can cause a slight loss of sys time accuracy. If a # user does many tests (>10) with *very* large counts (>10000) # or works on a very slow machine the cache may be useful. - &disablecache; - &clearallcache; + disablecache(); + clearallcache(); } sub debug { $Debug = ($_[1] != 0); } @@ -482,9 +482,8 @@ sub usage { return $_Usage{$calling_sub} || ''; } - # The cache needs two branches: 's' for strings and 'c' for code. The -# emtpy loop is different in these two cases. +# empty loop is different in these two cases. $_Usage{clearcache} = <<'USAGE'; usage: clearcache($count); @@ -891,7 +890,7 @@ sub cmpthese{ @vals = sort { $a->[7] <=> $b->[7] } @vals; # If more than half of the rates are greater than one... - my $display_as_rate = $vals[$#vals>>1]->[7] > 1; + my $display_as_rate = @vals ? ($vals[$#vals>>1]->[7] > 1) : 0; my @rows; my @col_widths;