Using NPH Scripts
Using NPH Scripts
NPH, or "no-parsed-header", scripts bypass the server
completely by sending the complete HTTP header directly to the browser. This has
slight performance benefits, but is of most use for taking advantage of HTTP
extensions that are not directly supported by your server, such as server push
and PICS headers.
Servers use a variety of conventions for designating CGI
scripts as NPH. IIS and many Unix servers look at the beginning of the script's
name for the prefix "nph-".
CGI.pm supports NPH scripts with a special NPH mode.
When in this mode, CGI.pm will output the necessary extra header information
when the header() and redirect() methods are called.
There are a number of ways to put CGI.pm into NPH mode:
In the use statement:
Simply
add "-nph" to the list of symbols to be imported into your script:
use CGI qw(:standard -nph)
By calling the nph() method:
Call
nph() with a non-zero parameter at any point after using CGI.pm in your
program.
CGI->nph(1)
By using -nph parameters in the header()
and redirect() statements:
print $q->header(-nph=>1);
|