Change 20546 by [EMAIL PROTECTED] on 2003/08/07 14:43:57

        Subject: [PATCH 5.8.1] Benchmark problem
        From: Radu Greab <[EMAIL PROTECTED]>
        Date: Thu, 07 Aug 2003 16:18:25 +0300 (EEST)
        Message-Id: <[EMAIL PROTECTED]>
        
        Subject: Re: [PATCH 5.8.1] Benchmark problem
        From: Rafael Garcia-Suarez <[EMAIL PROTECTED]>
        Date: Thu, 7 Aug 2003 15:48:38 +0200
        Message-Id: <[EMAIL PROTECTED]>

Affected files ...

... //depot/perl/lib/Benchmark.pm#34 edit
... //depot/perl/lib/Benchmark.t#15 edit

Differences ...

==== //depot/perl/lib/Benchmark.pm#34 (text) ====
Index: perl/lib/Benchmark.pm
--- perl/lib/Benchmark.pm#33~20463~     Sun Aug  3 21:37:25 2003
+++ perl/lib/Benchmark.pm       Thu Aug  7 07:43:57 2003
@@ -440,7 +440,7 @@
 
 sub mytime () { time }
 
-&init;
+init();
 
 sub BEGIN {
     if (eval 'require Time::HiRes') {
@@ -470,8 +470,8 @@
     # 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,43 +482,22 @@
     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.
-
-$_Usage{clearcache} = <<'USAGE';
-usage: clearcache($count);
-USAGE
+# empty loop is different in these two cases.
 
-sub clearcache    { 
-    die usage unless @_ == 1;
+sub clearcache ($) {
     delete $Cache{"$_[0]c"}; delete $Cache{"$_[0]s"}; 
 }
 
-$_Usage{clearallcache} = <<'USAGE';
-usage: clearallcache();
-USAGE
-
-sub clearallcache { 
-    die usage if @_;
+sub clearallcache () { 
     %Cache = (); 
 }
 
-$_Usage{enablecache} = <<'USAGE';
-usage: enablecache();
-USAGE
-
-sub enablecache   {
-    die usage if @_;
+sub enablecache () {
     $Do_Cache = 1; 
 }
 
-$_Usage{disablecache} = <<'USAGE';
-usage: disablecache();
-USAGE
-
-sub disablecache  {
-    die usage if @_;
+sub disablecache  () {
     $Do_Cache = 0; 
 }
 

==== //depot/perl/lib/Benchmark.t#15 (text) ====
Index: perl/lib/Benchmark.t
--- perl/lib/Benchmark.t#14~20463~      Sun Aug  3 21:37:25 2003
+++ perl/lib/Benchmark.t        Thu Aug  7 07:43:57 2003
@@ -583,7 +583,7 @@
 
     foreach my $func (@takes_no_args) {
         eval "$func(42)";
-        is( $@, $usage{$func}, "$func usage: with args" );
+        like( $@, qr/Too many arguments for Benchmark::$func/, "$func usage: with 
args" );
     }
 }
 
End of Patch.

Reply via email to