Well I had what I thought was a good idea but I am having a bit of trouble (as usual) so some tips would be appreciated....
I am trying to time searches and then show the time taken on the search results page.
So...I thought Id start by adding this code to search.cgi...
sub _time_start {
# ------------------------------------------------------------------
# Start a timer.
#
BEGIN { local $@; eval { require Time::HiRes; import Time::HiRes qw/time/; }; }
$TIME_START = time;
}
...then I thought I'd add _time_start(); in sub main. I then gave it a test by searching for anything but it gave me an internal server error. So I removed _time_start(); from sub main and tested again but I still got the error.
If that had worked I was planning on adding...
sub _time_display {
# ------------------------------------------------------------------
# Return time results.
#
my $end = time;
my $elapsed = sprintf ("%.2f", $end - $TIME_START);
return $elapsed;
}
...as a global called <%time%>, so that when I added <%time%> to search_results.html, it would tell me how long the search had taken.
What am I doing wrong?...both chunks of code are taken straight from nph_build.cgi so the syntax is correct!
Paul Wilson.
(Dont blame me if I'm wrong!)
I am trying to time searches and then show the time taken on the search results page.
So...I thought Id start by adding this code to search.cgi...
sub _time_start {
# ------------------------------------------------------------------
# Start a timer.
#
BEGIN { local $@; eval { require Time::HiRes; import Time::HiRes qw/time/; }; }
$TIME_START = time;
}
...then I thought I'd add _time_start(); in sub main. I then gave it a test by searching for anything but it gave me an internal server error. So I removed _time_start(); from sub main and tested again but I still got the error.
If that had worked I was planning on adding...
sub _time_display {
# ------------------------------------------------------------------
# Return time results.
#
my $end = time;
my $elapsed = sprintf ("%.2f", $end - $TIME_START);
return $elapsed;
}
...as a global called <%time%>, so that when I added <%time%> to search_results.html, it would tell me how long the search had taken.
What am I doing wrong?...both chunks of code are taken straight from nph_build.cgi so the syntax is correct!
Paul Wilson.
(Dont blame me if I'm wrong!)