Name:
Pi3Perl
Description:
Load and execute an Pi3Perl script extension.
Options:
Option | Default | Values | Short Description | Example(s) |
---|---|---|---|---|
Init | - | Any subroutine name in Pi3Perl file | Define a perl sub to be called for initialisation | Init="init" |
Excute | + | Any subroutine name in Pi3Perl file | Define a perl sub to be called for execution | Execute="exec" |
File | + | Any valid (.pl) file name | Define a Pi3Perl script to be loaded and executed | File="../Pi3Perl/snoopdb.pl" |
Phase:
HANDLE
Returns:
PIAPI_COMPLETED or PIAPI_ERROR according to the status returned by the extension.
Note:
For the PSP language specification refer to the respective Pi3-HOWTO page.
Example:
<Object> Name P3P Class FlexibleHandlerClass Condition "&cmp(&dblookup(response,string,ObjectMap),PSP)" CheckPath ReturnCode ReturnCode=COMPLETED CheckType ReturnCode ReturnCode=COMPLETED CheckAccess AccessByFile RequirePermissions="X" Handle Pi3Perl File="../Pi3Perl/snoopdb.pl" Pi3Perl Execute="execute" </Object>
A Pi3Perl file to perform Http redirects:
use strict; use Pi3; sub execute { my($obj) = shift; my($pihttp) = shift; my($iobuf) = shift; my($r) = Pi3::PIHTTP_getDB($pihttp, &Pi3::GETDB_RESPONSE); # Set the location header and the appropriate StatusCode (302 Found) my($l) = "http://localhost".Pi3::PIDB_lookup($r,&Pi3::PIDBTYPE_STRING,"PathInfo",&Pi3::PIDBFLAG_NONE); Pi3::PIDB_replace($r,&Pi3::PIDBTYPE_RFC822,"Location",$l,&Pi3::PIDBFLAG_NONE); Pi3::HTTPUtil_doHTTPError($pihttp,&Pi3::ST_FOUND); # Send HTTP status line and response headers Pi3::HTTPCore_sendGeneralHeaders($pihttp); Pi3::HTTPCore_sendEntityHeaders($pihttp, $r); return &Pi3::PIAPI_COMPLETED; }
:
Name:
PspHandler
Description:
Load and execute an PSP (Perl Server Pages) extension.
Options:
Option | Default | Values | Short Description | Example(s) |
---|---|---|---|---|
DestructLevel | - | 0, 1 | define destruction level for perl interpreters | DestructLevel 1 |
Phase:
HANDLE
Returns:
PIAPI_COMPLETED or PIAPI_ERROR according to the status returned by the extension.
Note:
For the PSP language specification refer to the respective Pi3-HOWTO page.
Example:
<Object> Name PSP Class FlexibleHandlerClass Condition "&cmp(&dblookup(response,string,ObjectMap),PSP)" CheckPath ReturnCode ReturnCode=COMPLETED CheckType ReturnCode ReturnCode=COMPLETED CheckAccess AccessByFile RequirePermissions="X" Handle PerlSrvPages </Object>
A PSP script to perform Http redirects:
<% sub pspSetResponse { $pspResponse{"Location"} = "http://localhost".$pspRequest{"PathInfo"}; $pspResponseStatus = 302; return 0; } %>