=head1 NAME PAR::Environment - Index and reference of PAR environment variables =head1 DESCRIPTION PAR uses various environment variables both during the building process of executables or PAR archives and the I 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 PAR uses. Wherever I want to refer to the C<$ENV{FOO}> environment hash entry, I will usually talk about the C variable for brevity. =head1 INDEX OF ENVIRONMENT VARIABLES B 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. =head2 PAR_0 If the running program is run from within a PAR 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 F into F and run F with this command par.pl foo.par bar.pl then the C variable will contain something like C where C is your username and C is the PAR cache directory (C). The name of the PAR cache directory can take a number of different forms, so use 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. This works the same for executable binaries (F<.exe>, ...). If you are looking for the name and path of the pp-ed binary file, please refer to the C variable. =head2 PAR_ARGC, PAR_ARGV_0, PAR_ARGV_... You should not rely on these variables outside of the PAR 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 as they would be used in C programs: C has the number of arguments, C has the name of the executable, 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 and C instead! Related: C, C, C =head2 PAR_CLEAN Users should set C instead. Recreated from C and the value of C<-C> from the YAML file by the PAR loader, and used within loader to control the initial behavior of extraction, and the final behavior of cleanup. The user can reference C in the application to determine which of these behaviors is being used for this run of the application. =head2 PAR_DEBUG Users should set C instead. If this variable is set to a true value and F is run, verbose output is sent to STDOUT or the logging filehandle. This is overridden by the C<-q> option to F, for steps after argument parsing occurs. This currently only influences F. Whether this is the intended behaviour remains to be verified. =head2 PAR_GLOBAL_CLEAN Setting C alters the behavior of par applications which see that environment variable at launch. C overrides the C<-C> option. Settings of 0 and 1 are supported. 0 corresponds to not using C<-C> on the pp command line; 1 corresponds to using C<-C> on the pp command line. C is ignored if C is set, yet it controls the form of C when C is not set. =head2 PAR_GLOBAL_DEBUG The PAR loader becomes more verbose when C is set. Setting C guarantees that C will be set internally, initially. See C for more details. =head2 PAR_GLOBAL_TEMP Contributes to the calculation of C, and is further explained there. =head2 PAR_GLOBAL_TMPDIR Contributes to the calculation of C, and is further explained there. =head2 PAR_INITIALIZED This environment variable is for internal use by the PAR binary loader only. Documented only to avoid surprises if spawned applications expect to see a value initialized by the user. =head2 PAR_PROGNAME C is set to the fully-qualified path name of the executable program. On Windows, this is reliably obtained from the C API. 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. =head2 PAR_APP_REUSE Strictly internal. Skip this section if you're not a PAR 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> 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 F loader script fetches the file name, deletes the environment variable, and then runs the given program. =head2 PAR_RUN This environment variable was set during constructions of C objects (usually during F runs only) by versions of PAR up to 0.957. Since PAR 0.958, this variable is unused. =head2 PAR_SPAWNED This variable is used internally by the F binary loader to signal the child process that it's the child. You should not rely on this variable outside of the PAR binary loader code. For a slightly more detailed discussion, please refer to the F documentation file in the PAR source distribution which was contributed by Alan Stewart. Related: C, C Documented only to avoid surprises if spawned applications expect to see a value initialized by the user. =head2 PAR_TEMP Users should set C instead. C is calculated from a variety of other variables. See the C section in the pod for PAR.pm for a complete description of how the calculation proceeds. C, once calculated, is used as the location where PAR stores its extracted, temporary file cache. =head2 PAR_TMPDIR Contributes to the calculation of C, and is further explained there. Users should set C instead. =head2 PAR_VERBATIM The C variable controls the way Perl code is packaged into a PAR archive or binary executable. If it is set to a true value during the packaging process, modules (and scripts) are B passed through the default C filter which removes all POD documentation from the code. Note that the C filter is still applied. The C<-F> option to the F tool overrides the C setting. That means if you set C but specify C<-F PodStrip> on the C command line, the C filter will be applied. C is not used by the PAR application. =head2 PAR_VERBOSE Setting this environment variable to a positive integer has the same effect as using the C<-verbose> switch to F. =head2 PP_OPTS During a F run, the contents of the C variable are treated as if they were part of the command line. In newer versions of PAR, you can also write options to a file and execute F as follows to read the options from the file: pp @FILENAME That can, of course, be combined with other command line arguments to F or the C variable. =head2 TMP, TEMP, TMPDIR, TEMPDIR Please refer to C. =head1 SEE ALSO L, L, L L, L, L L for details on PAR distributions. =head1 AUTHORS Steffen Mueller Esmueller@cpan.orgE You can write to the mailing list at Epar@perl.orgE, or send an empty mail to Epar-subscribe@perl.orgE to participate in the discussion. Please submit bug reports to Ebug-par@rt.cpan.orgE. If you need support, however, joining the Epar@perl.orgE mailing list is preferred. =head1 COPYRIGHT PAR: Copyright 2003-2010 by Audrey Tang, Ecpan@audreyt.orgE. This document: Copyright 2006-2010 by Steffen Mueller, Esmueller@cpan.orgE Some information has been taken from Alan Stewart's extra documentation in the F folder of the PAR distribution. This program or documentation is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See F. =cut