Merge remote-tracking (subtree) branch 'PracticingPerl/master'
This commit is contained in:
35
PracticingPerl/web/html/cgi-bin/query.cgi
Executable file
35
PracticingPerl/web/html/cgi-bin/query.cgi
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
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');
|
||||
|
||||
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;
|
||||
__END__
|
7
PracticingPerl/web/html/cgi-bin/test.cgi
Executable file
7
PracticingPerl/web/html/cgi-bin/test.cgi
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
printf("Content-Type: text/plain\n\n");
|
||||
printf("Hello Test\n");
|
||||
|
||||
1;
|
||||
__END__
|
Reference in New Issue
Block a user