Standalone PSP

[ Start > PikeApps > Standalone PSP ] [ Edit this Page | Show Page Versions | Show Raw Source ]


This is the Web.PikeServerPages.PSPCompiler class from Pike ScriptRunner, modified to run as a standalone CGI script, so no server-specific customization at all is needed. Place it somewhere (/usr/local/bin/pikesp for example), and put the following at the top of your PSP page:

#! /path/to/pike /usr/local/bin/pikesp

This line will be removed from the output. Make sure your PSP page ends with a CGI extension (.cgi for example). Note that each invocation will launch a new pike process, so be careful not to use complex modules like Calendar or your page-per-second rate will drop like a stone. Because of this, the following functions from Parser.HTML (which includes Calendar) are included directly in the script:

  • html_encode_string
  • http_decode_string
  • http_encode_query
  • http_decode_urlencoded_query

If you want to process forms, you'll have to parse them yourself:

/* merge GET and POST data into 'form' */
mixed form = http_decode_urlencoded_query(getenv("QUERY_STRING")||"");
form += http_decode_urlencoded_query(Stdio.stdin->read());

Download


Powered by PikeWiki2

 
gotpike.org | Copyright © 2004 - 2009 | Pike is a trademark of Department of Computer and Information Science, Linköping University