=head1 NAME stopwatch - benchmark mod_perl vs. CGI with File::CounterFile =head1 DESCRIPTION I have a stopwatch here. It consists of a CGI program that must be installed so that it can be accessed both as Apache::Registry routine and as CGI program. The program assumes that the environment variable SCRIPT_FILENAME is set and writes different counterfiles for the two access methods. On the client side I use LWP. Here's the CGI program: #!/usr/bin/perl use CGI::Switch; use File::CounterFile; # part of LWP my $q = new CGI::Switch; $q->print( $q->header, $q->start_html(), $q->start_form(), $q->textfield(-name => "textfield"), $q->submit(), $q->end_form, "
textfield = ", $q->param("textfield"), ); my $cfile = $ENV{SCRIPT_FILENAME} =~ m{/perl/} ? "C-apache" : "C-cgi"; my $c = File::CounterFile->new($cfile,"00000000"); my $id = $c->inc; $q->print( "