Re: what is the best way to log multiple search box activity?

Rusty Wilson <[email protected]>
Newsgroups gmane.comp.web.perlfect-search
Message-ID <[email protected]>
--- Daniel Naber <[email protected]> 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
_______________________________________________
perlfect-search mailing list
[email protected]
To unsubscribe, set other personal options or view the list archives please visit:
http://perlfect.com/mailman/listinfo/perlfect-search

lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.