#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    5
    Rep Power
    0

    Benchmark.pm error?


    My server updated the OS and hardware and since then I get this error when accessing a page.

    Software error:

    usage: $result_diff = timediff($result1, $result2);
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2012
    Posts
    776
    Rep Power
    495
    Can you provide more details on what you do (launchich a Perl script? benchmarking it?), in which conditions, etc.?
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    5
    Rep Power
    0
    Originally Posted by Laurent_R
    Can you provide more details on what you do (launchich a Perl script? benchmarking it?), in which conditions, etc.?

    the main cgi

    Code:
    use CGI::Carp "fatalsToBrowser";
    use CGI qw(:standard);
    use Benchmark;
    my $benchtime0 = Benchmark->new;
    $CGI::POST_MAX=1024 * 150;
    one of the cgi it calls

    Code:
    if ($mmode ne "on") {
     	my $benchtime1 = new Benchmark;
     	$timer = timestr(timediff($benchtime1,$benchtime0));
      ($tr, $tr, $tr, $a1, $b2, $c3, $d4, $e5, $f6, $g7, $h8, $i9, $j10, $k11) = split(/ /,$timer);
    
            #$print .= qq~<div align="center" class="bsmall">Script Benchmark: $a1 $b2 $c3 $d4 $e5 $f6 $g7 $h8 $i9 $j10 $k11</div>~;
    
            if ($query -> param('abc') ne 'xyz') { 
            	#print  &tempssi1("$print");
            	print $print;
            	 }
    
           # $print =~ s/\<\% URL \%\>/$urladdy/sg;
    
                   } else {
                    if ($foper1 eq "yes") {
                     $mm .= qq~$errorban~;
                    }
                    if ($foper2 eq "yes") {
                     $mm .= qq~$errorban1~;
    
                    }
                    if ($query -> param('abc') ne 'xyz') { print $mm;               }
    
                     }
                     if ($query -> param('abc') ne 'xyz') { 
                   #print  &tempssi1("$footer");
                 print $footer;
                 exit;
      }
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,875
    Rep Power
    1225
    What makes yo think the error is due to the Benchmark module?

    You need to post a more complete sample of the code and indicate which line the error message is referring to and if it's a line that calls a subroutine, you'll need to post that code as well.

    FYI, this Q is cross posted on perlguru.
    http://perlguru.com/gforum.cgi?post=76981;sb=post_latest_reply;so=ASC;forum_view=forum_view_collapsed;;page=unread#unrea d
    Last edited by FishMonger; November 5th, 2013 at 09:32 AM.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    5
    Rep Power
    0
    Originally Posted by FishMonger
    What makes yo think the error is due to the Benchmark module?

    You need to post a more complete sample of the code and indicate which line the error message is referring to and if it's a line that calls a subroutine, you'll need to post that code as well.
    you are right but it doesn't tell me allot...
    in the error logs or the page.
    which shows.

    Software error:

    usage: $result_diff = timediff($result1, $result2);
    For help, please send mail to the webmaster (webmaster@upperboards.com), giving this error message and the time and date of the error.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,875
    Rep Power
    1225
    That error message is not coming from the Benchmark module. It's a custom error message the author of the script setup (which I assume was not you).

    Look through the code to see where that "usage" message get printed.

    Since the message refers to the timediff() sub, you should look at that sub and the values you're passing to it.
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    5
    Rep Power
    0
    Originally Posted by FishMonger
    That error message is not coming from the Benchmark module. It's a custom error message the author of the script setup (which I assume was not you).

    Look through the code to see where that "usage" message get printed.

    Since the message refers to the timediff() sub, you should look at that sub and the values you're passing to it.
    yeah I am not the only one that did this code a big part was a friend and this was 10-13 years back so what I learned is not rusty but rotten out

    I downloaded all the files I could find that were connected and did a wide search for timediff() sub and only found 2 places but non of them seem to be coming from that exact error

    so I assumed it was maybe from the server side since this code has ran for 13 years until recently.
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,875
    Rep Power
    1225
    I assumed it was maybe from the server side since this code has ran for 13 years until recently.
    It very well could be due to a system upgrade. Given that the script(s) were written 10+ years ago, it's pretty much a guarantee that they're using some very old modules and if some of those modules were updated their interface may have changed enough to break your script.
  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    5
    Rep Power
    0
    Originally Posted by FishMonger
    It very well could be due to a system upgrade. Given that the script(s) were written 10+ years ago, it's pretty much a guarantee that they're using some very old modules and if some of those modules were updated their interface may have changed enough to break your script.
    the only place I can find this is in the

    usage: $result_diff = timediff($result1, $result2);

    Benchmark.pm

    Code:
    # --- Functions to process the 'time' data type
    535	
    536	sub new { my @t = (mytime, times, @_ == 2 ? $_[1] : 0);
    537	          print STDERR "new=@t\n" if $Debug;
    538	          bless \@t; }
    539	
    540	sub cpu_p { my($r,$pu,$ps,$cu,$cs) = @{$_[0]}; $pu+$ps         ; }
    541	sub cpu_c { my($r,$pu,$ps,$cu,$cs) = @{$_[0]};         $cu+$cs ; }
    542	sub cpu_a { my($r,$pu,$ps,$cu,$cs) = @{$_[0]}; $pu+$ps+$cu+$cs ; }
    543	sub real  { my($r,$pu,$ps,$cu,$cs) = @{$_[0]}; $r              ; }
    544	sub iters { $_[0]->[5] ; }
    545	
    546	
    547	$_Usage{timediff} = <<'USAGE';
    548	usage: $result_diff = timediff($result1, $result2);
    549	USAGE

IMN logo majestic logo threadwatch logo seochat tools logo