giving up on nginx for the moment and just using lighttpd, futzing a bit more with query example

This commit is contained in:
Dan Buch
2011-01-03 20:43:16 -05:00
parent 66f6eaff61
commit 6c2607df8d
4 changed files with 149 additions and 5 deletions

View File

@@ -3,20 +3,33 @@
use strict;
use warnings;
use CGI;
use CGI::Carp qw(carpout fatalsToBrowser);
BEGIN {
use CGI::Carp qw(carpout);
open(LOG, ">>/home/me/tmp/mycgi-log") or
die("Unable to open mycgi-log: $!\n");
carpout(*LOG);
}
sub main {
my $query = CGI->new();
print $query->header(-content_type => 'text/plain');
my $search = $query->param('q');
print $query->header();
print "You searched for: ", $query->escapeHTML($search);
if (!$search eq undef) {
printf("You searched for: %s\n", $query->escapeHTML($search));
} else {
printf("Invalid search? You must provide a 'q' argument.\n");
}
}
main();
1;
1;
__END__