[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Pi3Perl CGI-environment emulation
To ease port standard CGI's to Pi3Perl I've made some Perl code to emulate the
standard CGI environment. Here's a short statement how to use it:
use P3PCGI;
sub execute {
my($obj) = shift;
my($argc) = shift;
my($pihttp) = shift;
my($key);
my($response);
# initialize CGI environment
P3PCGI::init($obj,$argc,$pihttp);
# print $ENV hash into response
foreach $key (sort keys %ENV) {
$response .= sprintf("%s = %s\n", $key, $ENV{$key});
};
# append CGI input from buffer or environment to response
$response .= $ENV{CONTENT_LENGTH} ? $P3PCGI::inbuf : $ENV{QUERY_STRING};
};
Known restrictions
==================
The following $ENV keys are hard coded since I don't know how to get them:
$ENV{SERVER_PORT}
$ENV{SERVER_SOFTWARE}
Tried to redirect STDIN to use this handle. Worked good with standard Perl
but with Pi3Perl I got an assertion. Use $P3PCGI::inbuf meanwhile until I
can fix this.
Since I don't wanna spam the mailing list with 3 Perl programs send me
a e-mail to get the stuff. Example program how to iterate through the server
databases also available.
--
Have fun with it!
(Any response to enhance my Pi3Perl-work is very welcome)
Holger
---------------------------------------------------------
Holger 'Zimpel' Zimmermann Contact me:
---------------------------------------------------------
Wendishain tel./fax company: on demand
Germany tel./fax private: on demand
---------------------------------------------------------
homepage: http://home.t-online.de/home/zimpel/
web server: surf to it from my homepage (online every
Sunday 20:00-24:00 GMT, start shifted again)
e-Mail: zimpel@t-online.de
--------------------------------------------------------