in reply to Can Perl do this...?
As you already have Apache, most of the hard work is already done for you. The module CGI.pm solves the rest of your worries, and all should work more or less together in the following, untested fashion:
#!perl -wT use strict; use CGI qw(fatalsToBrowser); my $generator = 'c:/path/to/html/generator.exe'; my $filename = "c:/path/to/generated/html/page.html"; my $q = CGI->new(); my @generator_arguments; # The parameter "start_page" must contain a number: if ($q->param('start_page') =~ /^(\d+)$/) { push @generator_arguments, "--page_start", $1; }; # The parameter "text_string" must contain a string # with only characters a-zA-Z and blank: if ($q->param('text_string') =~ /^([a-zA-Z ])$/) { push @generator_arguments, "--text_string", $1; }; system($generator,@generator_arguments) == 0 or die "Couldn't start $generator: $! /$?"; # now read the generated HTML: open HTML,"<",$filename or die "Couldn't open $filename : $!"; my $html = do { local $/; <HTML> }; close HTML; print CGI::header(); print $html;
perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web
|
|---|