SCNR, but if you are lucky the target system has the required tools (compiler etc) to do the module installation, so you might not need to bundle Tk, but could just automagically run the CPAN install when needed. Of course, you could also run the commands to install the compiler first.

Visual Studio and Android Studio do the same thing, so if anyone asks, you can always say you are following industry standard practices ;-)

#!/usr/bin/env perl use strict; use warnings; use CPAN; use Module::Load; BEGIN { my @extramodules = ('Tk', 'Net::Clacks::Client'); foreach my $extramodule (@extramodules) { my $firstrun = 1; eval { load $extramodule; $firstrun = 0; }; if($firstrun) { # Run some commands to install required system tools. IDK +macos, so *shrug* # `brew install --yes gcc` print "Installing $extramodule...\n"; CPAN::Shell->install($extramodule); # Tk install runs a lot of tests that pop of weird windows +, but you could install without the tests #CPAN::Shell->notest('install', $extramodule); print "Installation complete, calling use again...\n"; load $extramodule; } else { print "Module loaded\n"; } } } my $top = MainWindow->new(); print "Done\n";

Edit: There are more than one ways to pack a camel. Your BEGIN block could just download&unzip a copy of your own lib directory and make sure it is in @INC. Or something along those lines.

PerlMonks XP is useless? Not anymore: XPD - Do more with your PerlMonks XP
Also check out my sisters artwork and my weekly webcomics

In reply to Re^3: How do I package up a Perl-TK app for macOS? by cavac
in thread How do I package up a Perl-TK app for macOS? by perltux

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.