You can localise the settings by wrapping your executables inside batch files, setting the env vars in the batch files, and calling the batch files instead of the executables. Whether it is practical for your system is another question, of course.
For example (untested):
set PAR_GLOBAL_TEMP=C:\some\path
exe_name.exe %*
Another alternative it to write a wrapper script in perl that sets the environment and then calls the original exe. This script can be packed using pp, with the original exe added using --addfile. You will need logic in the wrapper script to determine if it is running under PAR and thus where it needs to look for the executable.
# also untested
use Path::Tiny qw /path/;
use FindBin qw /$Bin/;
my $exe_name = 'some_exe';
my $exe_path;
if ($ENV{PAR_0}) { # running under PAR - look for the unpacked exe f
+ile
$exe_path = path ($ENV{PAR_TEMP}, 'inc', $exe_name)->stringify;
}
else { # not running under par, assume file is adjacent
$exe_path = path( $Bin, $exe_name )->stringify;
}
# set the env var
$ENV{GLOBAL_PAR_TEMP} = 'C:\some\path';
# now run it
# maybe use exec or wrap it in Capture::Tiny::capture
system $exe_path, @ARGV;