Kenichi Ishigaki

# NAME

perlws - application associated with PNLP files

# SYNOPSIS

    perlws.pl hello.pnlp

# DESCRIPTION

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.

# File Associations

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.

## Windows

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.

## Linux

For linux, with KDE, for example, one can add a file association by

• open the File Associations menu item under Control Center -> KDE Components

• add a new application entry of name x-perl-pnlp-file, with filename pattern *.pnlp. The application to handle this should be associated with the perlws.pl command.

An alternative route to this procedure is to right-click an existing .pnlp file within the file explorer window and choose the Edit File Type menu item.

# Server Configuration

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:

    #!/usr/bin/perl
print qq{Content-Disposition: filename="test.pnlp"\n};
print "Content-type: application/x-perl-pnlp-file\n\n";
print <<"END";
<?xml version="1.0" encoding="utf-8"?>
<pnlp spec="0.1"
codebase="http://www.perl.com"
href="hello.pnlp">
etc.
etc.
</pnlp>
END

# Environment Variables

The following environment variables, if set, will be used.

PAR_TEMP

If set, this will be the location where the downloaded par files will be stored. If not set, a subdirectory par beneath the temporary directory specified by File::Spec->tmpdir will be used.

PAR_CLEAN

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).