2011-01-03 22:32:50 +00:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use CGI;
|
2011-01-04 01:43:16 +00:00
|
|
|
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);
|
|
|
|
}
|
2011-01-03 22:32:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
sub main {
|
|
|
|
my $query = CGI->new();
|
2011-01-04 01:43:16 +00:00
|
|
|
print $query->header(-content_type => 'text/plain');
|
2011-01-03 22:32:50 +00:00
|
|
|
|
2011-01-04 01:43:16 +00:00
|
|
|
my $search = $query->param('q');
|
2011-01-03 22:32:50 +00:00
|
|
|
|
2011-01-04 01:43:16 +00:00
|
|
|
if (!$search eq undef) {
|
|
|
|
printf("You searched for: %s\n", $query->escapeHTML($search));
|
|
|
|
} else {
|
|
|
|
printf("Invalid search? You must provide a 'q' argument.\n");
|
|
|
|
}
|
2011-01-03 22:32:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
main();
|
|
|
|
|
|
|
|
|
2011-01-04 01:43:16 +00:00
|
|
|
1;
|
2011-01-03 22:32:50 +00:00
|
|
|
__END__
|