DESCRIPTION

\s-1PAR\s0 uses various environment variables both during the building process of executables or \s-1PAR\s0 archives and the use of them. Since the wealth of combinations and settings might confuse one or the other (like me), this document is intended to document all environment variables which \s-1PAR\s0 uses.

Wherever I want to refer to the $ENV{FOO} environment hash entry, I will usually talk about the \*(C`FOO\*(C' variable for brevity.

INDEX OF ENVIRONMENT VARIABLES

Please note that this is still very, very incomplete! Contributions welcome!

For each variable, there should be a description what it contains, when it can be expected to exist (and contain meaningful information), when it is sensible to define it yourself, and what effect this has.

Of course, the description may use examples.

\s-1PAR_0\s0

If the running program is run from within a \s-1PAR\s0 archive or pp-produced executable, this variable contains the name of the extracted program (i.e. .pl file). This is useful of you want to open the source code file of the running program.

For example, if you package a file foo.pl into bar.par and run foo.pl with this command

  par.pl foo.par bar.pl

then the \*(C`PAR_0\*(C' variable will contain something like \*(C`/tmp/par-youser/cache-b175f53eb731da9594e0dde337d66013ddf25a44/495829f0.pl\*(C' where \*(C`youser\*(C' is your username and \*(C`/tmp/par-youser/cache-b175f53eb731da9594e0dde337d66013ddf25a44/\*(C' is the \s-1PAR\s0 cache directory (\*(C`PAR_TEMP\*(C').

The name of the \s-1PAR\s0 cache directory can take a number of different forms, so use \*(C`PAR_0\*(C' if you want to find the extracted program's .pl file \*(-- attempting to construct the name yourself requires complex logic that has already produced the value in \*(C`PAR_0\*(C'.

This works the same for executable binaries (.exe, ...).

If you are looking for the name and path of the pp-ed binary file, please refer to the \*(C`PAR_PROGNAME\*(C' variable.

\s-1PAR_ARGC\s0, \s-1PAR_ARGV_0\s0, \s-1PAR_ARGV_\s0...

You should not rely on these variables outside of the \s-1PAR\s0 binary loader code.

These variables are set when a non-dependent pp-ed binary executable runs. The initially executed process extracts another binary and runs it as a child process. In order to pass its command line arguments to the child, the parent process sets \*(C`PAR_ARG*\*(C' as they would be used in C programs: \*(C`PAR_ARGC\*(C' has the number of arguments, \*(C`PAR_ARGV_0\*(C' has the name of the executable, \*(C`PAR_ARGV_*\*(C' are the command line arguments.

If you would like to access the name of the running program (script or binary), please refer to \*(C`PAR_0\*(C' and \*(C`PAR_PROGNAME\*(C' instead!

Related: \*(C`PAR_SPAWNED\*(C', \*(C`PAR_0\*(C', \*(C`PAR_PROGNAME\*(C'

\s-1PAR_CLEAN\s0

Users should set \*(C`PAR_GLOBAL_CLEAN\*(C' instead. Recreated from \*(C`PAR_GLOBAL_CLEAN\*(C' and the value of \*(C`-C\*(C' from the \s-1YAML\s0 file by the \s-1PAR\s0 loader, and used within loader to control the initial behavior of extraction, and the final behavior of cleanup. The user can reference \*(C`PAR_CLEAN\*(C' in the application to determine which of these behaviors is being used for this run of the application.

\s-1PAR_DEBUG\s0

Users should set \*(C`PAR_GLOBAL_DEBUG\*(C' instead.

If this variable is set to a true value and par.pl is run, verbose output is sent to \s-1STDOUT\s0 or the logging filehandle. This is overridden by the \*(C`-q\*(C' option to par.pl, for steps after argument parsing occurs.

This currently only influences par.pl. Whether this is the intended behaviour remains to be verified.

\s-1PAR_GLOBAL_CLEAN\s0

Setting \*(C`PAR_GLOBAL_CLEAN\*(C' alters the behavior of par applications which see that environment variable at launch. \*(C`PAR_GLOBAL_CLEAN\*(C' overrides the \*(C`-C\*(C' option. Settings of 0 and 1 are supported. 0 corresponds to not using \*(C`-C\*(C' on the pp command line; 1 corresponds to using \*(C`-C\*(C' on the pp command line. \*(C`PAR_GLOBAL_CLEAN\*(C' is ignored if \*(C`PAR_GLOBAL_TEMP\*(C' is set, yet it controls the form of \*(C`PAR_TEMP\*(C' when \*(C`PAR_GLOBAL_TEMP\*(C' is not set.

\s-1PAR_GLOBAL_DEBUG\s0

The \s-1PAR\s0 loader becomes more verbose when \*(C`PAR_DEBUG\*(C' is set. Setting \*(C`PAR_GLOBAL_DEBUG\*(C' guarantees that \*(C`PAR_DEBUG\*(C' will be set internally, initially. See \*(C`PAR_DEBUG\*(C' for more details.

\s-1PAR_GLOBAL_TEMP\s0

Contributes to the calculation of \*(C`PAR_TEMP\*(C', and is further explained there.

\s-1PAR_GLOBAL_TMPDIR\s0

Contributes to the calculation of \*(C`PAR_TEMP\*(C', and is further explained there.

\s-1PAR_INITIALIZED\s0

This environment variable is for internal use by the \s-1PAR\s0 binary loader only. Documented only to avoid surprises if spawned applications expect to see a value initialized by the user.

\s-1PAR_PROGNAME\s0

\*(C`PAR_PROGNAME\*(C' is set to the fully-qualified path name of the executable program. On Windows, this is reliably obtained from the \*(C`GetModuleFileName\*(C' \s-1API\s0. On other OSes, if the C runtime is given a qualified path name, it is used, or the unqualified file name given is qualified by walking the path. This is reasonably reliable given normal program spawning conventions, but cannot be guaranteed to be correct in all circumstances.

\s-1PAR_APP_REUSE\s0

Strictly internal. Skip this section if you're not a \s-1PAR\s0 developer.

The variable shouldn't ever be exposed to user code and packaged applications should not depend on it being set or not.

If an application has been packaged with the \*(C`--reusable\*(C' option, the bootstrapping code will set this environment variable to the name of the program that is to be run instead of the packaged program. The main.pl loader script fetches the file name, deletes the environment variable, and then runs the given program.

\s-1PAR_RUN\s0

This environment variable was set during constructions of \*(C`PAR::Packer\*(C' objects (usually during pp runs only) by versions of \s-1PAR\s0 up to 0.957. Since \s-1PAR\s0 0.958, this variable is unused.

\s-1PAR_SPAWNED\s0

This variable is used internally by the parl binary loader to signal the child process that it's the child.

You should not rely on this variable outside of the \s-1PAR\s0 binary loader code. For a slightly more detailed discussion, please refer to the who_am_i.txt documentation file in the \s-1PAR\s0 source distribution which was contributed by Alan Stewart. Related: \*(C`PAR_ARGC\*(C', \*(C`PAR_ARGV_*\*(C'

Documented only to avoid surprises if spawned applications expect to see a value initialized by the user.

\s-1PAR_TEMP\s0

Users should set \*(C`PAR_GLOBAL_TEMP\*(C' instead. \*(C`PAR_TEMP\*(C' is calculated from a variety of other variables. See the \*(C`NOTES\*(C' section in the pod for \s-1PAR\s0.pm for a complete description of how the calculation proceeds. \*(C`PAR_TEMP\*(C', once calculated, is used as the location where \s-1PAR\s0 stores its extracted, temporary file cache.

\s-1PAR_TMPDIR\s0

Contributes to the calculation of \*(C`PAR_TEMP\*(C', and is further explained there. Users should set \*(C`PAR_GLOBAL_TMPDIR\*(C' instead.

\s-1PAR_VERBATIM\s0

The \*(C`PAR_VERBATIM\*(C' variable controls the way Perl code is packaged into a \s-1PAR\s0 archive or binary executable. If it is set to a true value during the packaging process, modules (and scripts) are not passed through the default \*(C`PAR::Filter::PodStrip\*(C' filter which removes all \s-1POD\s0 documentation from the code. Note that the \*(C`PAR::Filter::PatchContent\*(C' filter is still applied.

The \*(C`-F\*(C' option to the pp tool overrides the \*(C`PAR_VERBATIM\*(C' setting. That means if you set \*(C`PAR_VERBATIM=1\*(C' but specify \*(C`-F PodStrip\*(C' on the \*(C`pp\*(C' command line, the \*(C`PodStrip\*(C' filter will be applied.

\*(C`PAR_VERBATIM\*(C' is not used by the \s-1PAR\s0 application.

\s-1PAR_VERBOSE\s0

Setting this environment variable to a positive integer has the same effect as using the \*(C`-verbose\*(C' switch to pp.

\s-1PP_OPTS\s0

During a pp run, the contents of the \*(C`PP_OPTS\*(C' variable are treated as if they were part of the command line. In newer versions of \s-1PAR\s0, you can also write options to a file and execute pp as follows to read the options from the file:

pp @FILENAME

That can, of course, be combined with other command line arguments to pp or the \*(C`PP_OPTS\*(C' variable.

\s-1TMP\s0, \s-1TEMP\s0, \s-1TMPDIR\s0, \s-1TEMPDIR\s0

Please refer to \*(C`PAR_TMPDIR\*(C'.

RELATED TO PAR::Environment…

The \s-1PAR\s0 homepage at <http://par.perl.org>.

\s-1PAR\s0, PAR::Tutorial, \s-1PAR::FAQ\s0 (For a more current \s-1FAQ\s0, refer to the homepage.)

par.pl, parl, pp

PAR::Dist for details on \s-1PAR\s0 distributions.

AUTHORS

Steffen Mueller <[email protected]>

<http://par.perl.org/> is the official \s-1PAR\s0 website. You can write to the mailing list at <[email protected]>, or send an empty mail to <[email protected]> to participate in the discussion.

Please submit bug reports to <[email protected]>. If you need support, however, joining the <[email protected]> mailing list is preferred.

COPYRIGHT

\s-1PAR:\s0 Copyright 2003-2010 by Audrey Tang, <[email protected]>.

This document: Copyright 2006-2010 by Steffen Mueller, <[email protected]>

Some information has been taken from Alan Stewart's extra documentation in the contrib/ folder of the \s-1PAR\s0 distribution.

This program or documentation is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See <http://www.perl.com/perl/misc/Artistic.html>