Added Apache CGI/FCGI/mod_perl examples

This commit is contained in:
Patrick Donelan 2009-10-11 01:07:08 +11:00
parent e9893b25f4
commit 784e0bd73c
5 changed files with 39 additions and 2 deletions

21
apache.conf Normal file
View file

@ -0,0 +1,21 @@
<VirtualHost *:80>
PerlOptions +Parent
PerlSwitches -I/data/WebGUI/lib
# CGI
#AddHandler cgi-script cgi
#ScriptAlias / /data/WebGUI/etc/dev.localhost.localdomain.cgi/
#<Directory /data/WebGUI/etc>
# Options +ExecCGI
#</Directory>
# Apache2
#SetHandler perl-script
#PerlHandler Plack::Server::Apache2
#PerlSetVar psgi_app /data/WebGUI/etc/dev.localhost.localdomain.psgi
# FastCGI
FastCgiServer /data/WebGUI/etc/dev.localhost.localdomain.fcgi
ScriptAlias / /data/WebGUI/etc/dev.localhost.localdomain.fcgi/
</VirtualHost>

View file

@ -0,0 +1,5 @@
#!/usr/bin/perl
use Plack::Server::CGI;
my $app = Plack::Util::load_psgi("/data/WebGUI/etc/dev.localhost.localdomain.psgi");
Plack::Server::CGI->new->run($app);

View file

@ -0,0 +1,5 @@
#!/usr/bin/perl
use Plack::Server::FCGI;
my $app = Plack::Util::load_psgi("/data/WebGUI/etc/dev.localhost.localdomain.psgi");
Plack::Server::FCGI->new->run($app);

View file

@ -6,7 +6,8 @@ BEGIN {
our $WEBGUI_CONFIG = 'dev.localhost.localdomain';
our $DOCUMENT_ROOT = '/data/domains/dev.localhost.localdomain/public';
}
use local::lib $WEBGUI_ROOT;
use lib "$WEBGUI_ROOT/lib";
#use local::lib $WEBGUI_ROOT;
use WebGUI;
use Plack::Builder;

View file

@ -47,12 +47,17 @@ sub headers_out { shift->{headers_out} }
sub protocol { shift->{request}->protocol(@_) }
sub status { shift->{response}->status(@_) }
sub sendfile { $_[0]->{sendfile} = $_[1] }
sub content_type { shift->{response}->content_type(@_) }
sub server { shift->{server} }
sub method { shift->{request}->method }
sub upload { shift->{request}->upload(@_) }
sub status_line { }
sub auth_type { } # should we support this?
sub handler { 'perl-script' } # or not..?
sub content_type {
my ($self, $ct) = @_;
$self->{headers_out}->set( 'Content-Type' => $ct );
}
# These two cookie subs are called from our wG Plack-specific code
sub get_request_cookies {