From 2f378f2720eee237f7dbe20643d6c2626c038580 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Wed, 28 May 2008 05:42:08 +0000 Subject: [PATCH] set $PLP::interface to executing backend Useful to know how we're running, as code may want to target specific backends. Currently undocumented so that behaviour can be changed easily if need be. --- PLP/Backend/Apache.pm | 1 + PLP/Backend/CGI.pm | 1 + PLP/Backend/FastCGI.pm | 1 + eg/plpinfo.plp | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/PLP/Backend/Apache.pm b/PLP/Backend/Apache.pm index eb13d36..62caadc 100644 --- a/PLP/Backend/Apache.pm +++ b/PLP/Backend/Apache.pm @@ -71,6 +71,7 @@ sub print { # This is the mod_perl handler. sub handler { PLP::clean(); + $PLP::interface = __PACKAGE__; if (my $ret = init($_[0])) { return $ret; } diff --git a/PLP/Backend/CGI.pm b/PLP/Backend/CGI.pm index 1a4f49c..e4bcf1e 100644 --- a/PLP/Backend/CGI.pm +++ b/PLP/Backend/CGI.pm @@ -72,6 +72,7 @@ sub everything { # This is run by the CGI script. (#!perl \n use PLP::Backend::CGI;) sub import { + $PLP::interface = $_[0]; $_[0]->everything(); } diff --git a/PLP/Backend/FastCGI.pm b/PLP/Backend/FastCGI.pm index 85a5234..8594a85 100644 --- a/PLP/Backend/FastCGI.pm +++ b/PLP/Backend/FastCGI.pm @@ -10,6 +10,7 @@ our $VERSION = '1.01'; sub import { my $self = shift; + $PLP::interface = $self; my $request = FCGI::Request(); $SIG{TERM} = sub { $request->LastCall(); diff --git a/eg/plpinfo.plp b/eg/plpinfo.plp index 9578327..748d40c 100644 --- a/eg/plpinfo.plp +++ b/eg/plpinfo.plp @@ -24,7 +24,7 @@ use Config; printf "%s%s\n", @$_ for ( ["System" => qx(uname -snrvm)], - ["Server API" => "CGI/FastCGI - ".$PLP::interface], #TODO + ["Server API" => $PLP::interface ? $PLP::interface : "?"], ["Perl" => join ".", map ord, split //, $^V], ["Build Date" => $Config{cf_time}], ["Debug Build" => $^P ? "yes" : "no"], -- 2.30.0