#!/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";