I am experimenting with Tcl::pTk after being inspired by some recent posts on this group. I need to create an executable for macOS of my Tcl::pTk application with pp and bundle it in a .app for distribution. Letís say it is a simple GUI that reads the tcl version:
my $int = new Tcl::pTk;
# pure-tcl code to create widgets (e.g. generated by some GUI builder)
.e insert end "tcl_version $tcl_version\n"
.e insert end "tcl_patchLevel $tcl_patchLevel\n"
.e insert end "tk_version $tk_version\n"
.e insert end "tk_patchLevel $tk_patchLevel\n"
.e insert end "tk_library $tk_library\n"
my $e = $int->widget('.e'); # get .e entry into play
$e->insert( "end", "
The executable is generated with:
pp -o TEST test.pl
The generated executable works fine and uses the Tcl version that it finds on the system (normally the standard tcl framework in HD/System/Library/Frameworks/Tk.framework (8.5)). If I install a new Tcl version (for example ActiveTcl 8.6) or if I run it on another machine, the executable will automatically link to the new tcl framework. If I understand it correctly, the Tcl/Tcl::pTk modules dynamically read the directory where to find Tcl (using some environmental variables?). With this architecture, however, I am not in control over the Tcl version my application will use on a third machine. Not nice. The better option would be to include a tcl framework in my .app. I need to ship it within the .app containing my executable and have tcl/tcl::pTk inside my executable linked to it. A normal .app has the following structure:
How do I link my Tcl/Tcl::pTk modules (packed in TEST) to this particular installation of Tcl? I guess I should change the environmental path at the beginning of my script. Some posts here on perlmonks (related to Windows however) say it is necessary to set PERL_TCL_DL_PATH in a begin loop, but after two days of trying I haven't come up with any working solution. Any suggestion would be VERY MUCH appreciated.