in reply to par::packer with Tkx and Strawberry perl

Hello, All,

I know, this is an old discussion. But I struggled the last days with the same problem and think that I have found a clean solution.

Tcl doesn't find init.tcl, because the shell environment variable $ENV{TCL_Library} points to the wrong place, I think. Altering the environment variables of a parent process is not easy, but I think the following solution is the best and cleanest solution, if you don't want to use a tkkit.

You only have to add the following begin block to you Tcl::Tk or Tkx perl script:

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(); } }

I hope, this will help someone.. It is really cool to distribute the perl/Tcl::Tk scripts with pp...

Best wishes,

Max

Replies are listed 'Best First'.
Re: par::packer with Tkx and Strawberry perl
by Anonymous Monk on Jun 02, 2018 at 18:49 UTC

    PS.: the perl script in the example above is packed as follows: 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 the period before "/". I don't know, why...

Re^2: par::packer with Tkx and Strawberry perl
by Anonymous Monk on Oct 14, 2019 at 17:20 UTC

    Thank you. The Tcl module is the worst documented module ever when it comes to instructions on how to bind a particular TCL/TK to a Perl script. Your solution for example doesn't seem to work if you are on Mac and you are using TCL/TK.Frameworks