Hello everybody,
I wanted to share with you, how I could use pp with Tcl::Tk. This topic was
discussed here some years ago (see
https://www.nntp.perl.org/group/perl.tcltk/2015/09/msg682.html), but the
proposed solutions didn't work for me.
The problem is, that one has to change the shell environment variabe
$ENV{TCL_Library}. But this is not simple, because the child process (the perl
program) cannot change the environment variables of the parent process.
My solution was the following BEGIN block:
BEGIN {
if ($ENV{PAR_TEMP} && $ENV{TCL_Library} ne
"$ENV{PAR_TEMP}/inc/lib/tcl8.6") {
print "Starting a Tcl::Tk PAR-exe file\n";
print "We need to set shell environment variables first \n";
$ENV{TCL_Library} = "$ENV{PAR_TEMP}/inc/lib/tcl8.6";
# I don't know whether this is really necessary?
$ENV{TK_Library} = "$ENV{PAR_TEMP}/inc/lib/tcl8.6";
system($0);
exit();
}
}
To pack the perl script I use this command:
pp -l "C:/Tcl/bin/tcl86.dll" -l "c:/Tcl/bin/tk86.dll" -l "c:/Tcl/bin/zlib1.dll"
-a "C:/Tcl;./" -o tktest.exe ./tktest.pl
Important is to rename the directory C:/Tcl to "./". Especially you must have
the point before the "/". I don't know why ;-) but it works ...
Perhaps this is helpful for someone...
Best wishes,
Max