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:

use strict; use warnings; use Tk; use Tcl::pTk; my $int = new Tcl::pTk; $int->Eval(<<'EOS'); # pure-tcl code to create widgets (e.g. generated by some GUI builder) text .e ## http://wiki.tcl.tk/1626#tk_version .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" pack .e EOS my $e = $int->widget('.e'); # get .e entry into play $e->insert( "end", " Tcl::pTk $Tcl::pTk::VERSION Tcl $Tcl::VERSION \$^V $^V \$] $] "); $int->MainLoop;

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:

MyApp.app/ Contents/ Info.plist Frameworks/ Tcl.framework/ Tk.framework/ MacOS/ TEST Resources/ MyApp.icns

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.


In reply to macOS tcl::pTk packing Tcl by IB2017

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.