Perlfect Solutions
 

[Perlfect-search] what is the best way to log multiple search box activity?

Rusty Wilson perlfect-search@perlfect.com
Fri, 23 Aug 2002 11:15:00 -0700 (PDT)
--- Daniel Naber <daniel.naber@t-online.de> wrote:
> You'll have to modify the log_query() function in search.pl so that it 
> writes one more column that contains the "name" of the box (hidden 
> parameter).

Assuming I put the following in the search form:
<input type="hidden" name="searchbox" value="oem">

Would this be the correct modification so that oem appears in the log file?

sub log_query {
  return if( ! $LOG );

  my $elapsed_time = sprintf("%.2f", Time::HiRes::tv_interval($start_time)) if(
$start_time );
  my @line = ();
  my $addr = $ENV{'REMOTE_HOST'} || $ENV{'REMOTE_ADDR'};
  push(@line, $addr || '-',
              get_iso_date(), 
                          $query->param('searchbox'),
              $query->param('q') || '-',
              scalar(keys %answer),
              $query->param('p') || 1,
              $elapsed_time || '-');
  
  use Fcntl ':flock';        # import LOCK_* constants
  open(LOG, ">>$LOGFILE") or die "Cannot open logfile '$LOGFILE' for writing:
$!";
  flock(LOG, LOCK_EX);
  seek(LOG, 0, 2);
  print LOG join(';', @line).";\n";
  flock(LOG, LOCK_UN);
  close(LOG);
}

=====
The Website your boss doesn�t want you to know about! (pssst...it's FREE!)
http://www.ezinfocenter.com/7421656/FREE
=====

__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com