This script should be registered to open PNLP files from the browser (how to do that is described later). When this is done, the script will read the information contained within the file, fetch the required par files that are specified, and then form and run the command to execute the specified main script.

Associating an application with a file extension in a browser environment depends on the browser and platform. With some browsers, an option in one of the browser menus allows one to do this directly. In this case, one should open files with a .pnlp extension with perlws.pl (probably specifying the complete path). If needed, the Content-Type of the file should be specified as application/x-perl-pnlp-file.

On Windows, this association can be done, after installation, by running the included pnlp_registry.pl script in this distribution, which will add the appropriate Registry settings. If this script fails, or you'd prefer to do this this manually, carry out the following steps.

Open up My Computer, and find the File Types tab under Folder Options of Tools (the exact location may vary, depending on the flavour of Windows used).

Create a new file type PNLP File, with extension .pnlp.

Using the Change and Advanced buttons, arrange to associate with this file type an action of open, with the associated application being

C:\Path\to\Perl\bin\perlws.bat "%1"

The content-type associated with .pnlp files can be done through the Windows Registry by adding a new Content-Type key to the .pnlp file extension registry entry, with a value of application/x-perl-pnlp-file.

On the server side, it's probably a good idea to also associate the content-type of application/x-perl-pnlp-file with .pnlp file extensions. On Apache, this can be done within the httpd.conf file by adding the directive

Addtype application/x-perl-pnlp-file .pnlp

Special consideration must be given when generating the PNLP dynamically, as in, for example, a CGI script, as in this case there likely would not be a .pnlp file extension present. One way to do this is through a Content-Disposition header, as in the following example of a CGI script:

If set, the downloaded par files will be removed after use. The default is to not remove such files, so as to provide a cache for later use (the md5 checksum of the cached file will be checked against that on the server to decide if an update to the cached file is available).