Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: How do I package up a Perl-TK app for macOS?

by cavac (Prior)
on Nov 18, 2025 at 12:20 UTC ( [id://11166738]=note: print w/replies, xml ) Need Help??


in reply to Re^2: How do I package up a Perl-TK app for macOS?
in thread How do I package up a Perl-TK app for macOS?

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11166738]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2026-01-13 03:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (118 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.