Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: pp: modules disappearing while program runs?

by Anonymous Monk
on Apr 07, 2022 at 20:57 UTC ( [id://11142808]=note: print w/replies, xml ) Need Help??


in reply to Re: pp: modules disappearing while program runs?
in thread pp: modules disappearing while program runs?

I tried using PAR_GLOBAL_TEMP, but the huge problem with it is that /par-USER/cache-XXXXXXX does not get added to the end of it, so *every* par packed EXE running on the system goes into the same directory (PAR_GLOBAL_TEMP) and rediculously bad things happen

My *guess* is that I need to use PAR_TMPDIR ... but the documentation doesn't really say what it does, it just says use PAR_GLOBAL_TEMP instead.... *sigh*

  • Comment on Re^2: pp: modules disappearing while program runs?

Replies are listed 'Best First'.
Re^3: pp: modules disappearing while program runs?
by swl (Parson) on Apr 07, 2022 at 22:06 UTC

    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;
Re^3: pp: modules disappearing while program runs?
by Anonymous Monk on Apr 07, 2022 at 21:04 UTC

    Looking at the source... yeah there seems to be no way to do it. You would have to have a different PAR_GLOBAL_TEMP setting in the scope of every single exe that runs on the system... :-(

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11142808]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2024-04-18 03:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found