in reply to Re^2: Establishing a beachhead and acquiring privileges on a Mac-mini
in thread Establishing a beachhead and acquiring privileges on a Mac-mini

G'day Aldebaran,

"... I do not know the perl command to update itself."

Having been advised against using the system Perl on Mac, you wouldn't be doing this even if Perl had such a command. Correct?

I used Perlbrew on Mac for about nine years and never had any problems. I changed to Cygwin on Win10 about five years ago; still using Perlbrew and still having no problems.

Following links from Perlbrew, you'll eventually get to CPAN: perlbrew. Here you'll find documentation for perlbrew commands; in the context of the current discussion, the most pertinent are probably install, upgrade-perl, and install-cpanm.

Once you have Perlbrew installed, you can easily switch between whatever versions of Perl you have; e.g.

$ perl -v | head -2 | tail -1 This is perl 5, version 36, subversion 0 (v5.36.0) built for cygwin-th +read-multi $ perlbrew switch perl-5.32.0 $ perl -v | head -2 | tail -1 This is perl 5, version 32, subversion 0 (v5.32.0) built for cygwin-th +read-multi $ perlbrew switch perl-5.36.0 $ perl -v | head -2 | tail -1 This is perl 5, version 36, subversion 0 (v5.36.0) built for cygwin-th +read-multi

I recommend using the following shebang in your scripts.

#!/usr/bin/env perl

This means that the script will use whatever Perl version is current.

$ cat test_shebang.pl #!/usr/bin/env perl print $^V; $ ./test_shebang.pl v5.36.0 $ perlbrew switch perl-5.33.5 $ perl -v | head -2 | tail -1 This is perl 5, version 33, subversion 5 (v5.33.5) built for cygwin-th +read-multi $ ./test_shebang.pl v5.33.5

— Ken

Replies are listed 'Best First'.
Re^4: Establishing a beachhead and acquiring privileges on a Mac-mini
by Aldebaran (Curate) on May 07, 2023 at 02:51 UTC
    I recommend using the following shebang in your scripts.

    I wish I had seen your reply before I reposted.

    #!/usr/bin/env perl

    fixed me entirely, thanks...I'll take another look at perlbrew, but I honestly have to pick my battles. It's all going much slower than I wanted, but I'm finally getting something like a toolchain started. Good to know that it can be done without conflict.

      "fixed me entirely, thanks"

      Glad I could help.

      "I'll take another look at perlbrew, but I honestly have to pick my battles."

      As I indicated in my previous post, it's been five years since I've used a Mac; my information could be out-of-date. Having said that, for the nine years that I did use Mac, upgrades to the system would typically wipe out older versions of Perl and replace them with newer ones: this would not only delete the core Perl code but also any modules that the user may have installed with that version. You could potentially lose a lot; recovery may be problematical; and, the old Perl version is no longer available to you (which may or may not be important).

      In addition, installing modules in the system Perl may have subtle side-effects. For instance, you install X::Y::Z; this has a dependency of A::B::C with a version greater than what comes with the system Perl; the installation of X::Y::Z automatically upgrades A::B::C; this may potentially change how the system Perl works; in turn, this could affect how the O/S works, possibly with dire consequences.

      I'd guess Perlbrew is the most used but there are other options (with which I'm not overly familiar); as I know Perlbrew, and have used it successfully for well over a decade, it's what I recommend. Choose whatever you want but, like others, I strongly recommend against using the system Perl. Whatever Perl versions and modules you've installed will not be deleted with an upgrade to the Mac O/S.

      Don't win a quick battle only to subsequently lose the war. :-)

      — Ken