in reply to cgi or mod_perl
And the cgi-bin# here is the web page. package WebPageOne; sub new { bless {}, shifth; } sub html { print <<EOP; <head> <body> This is a web page. </body> </head> } 1;
And the mod_perl handler.#!/usr/bin/perl # webpageone.cgi use WebPageOne; print "content-type: text/html\n\n"; my $x = WebPageOne->new() print $x->html;
Of course these examples are missing most of the extra stuff you get from CGI and Apache, but normally all that is needed is CGI->param() and that can be hand rolled. Or you can pass in an instance of Apache::CGI or CGI to WebPageOne and use it for your CGI needs.package ModPerlPageOne; use Apache2::Const -compile => qw(OK); sub handler { my $r = shift; my $x = WebPageOne->new(); $r->send_http_header('text/html'); $r->print $x->html; return OK; }
|
|---|