develooper Front page | perl.tcltk | Postings from August 2019

Using PAR/pp with Tcl::Tk

From:
max.augsburg
Date:
August 14, 2019 02:23
Subject:
Using PAR/pp with Tcl::Tk
Message ID:
trinity-321f3070-b6c3-4109-be35-bb4dfea2c61a-1565642431731@3c-app-gmx-bs20

 
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



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About