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.
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |