What have I forgotten about specifying which Perl should be /opt/local/bin/perl?

Gabriel Rosenkoetter gr at eclipsed.net
Fri Jan 21 04:12:19 UTC 2022


Aha!

I didn't have the perl5 port installed on this system at all, just the 
several perl5.xx ports. So I did `sudo port install perl5`.

And that's neat, but:

[58] (gr at wedge:~)% which perl
/opt/local/bin/perl
[59] (gr at wedge:~)% ls -l `!!`
ls -l `which perl`
lrwxr-xr-x  1 root  admin  8 Dec  6  2020 /opt/local/bin/perl -> perl5.28
[60] (gr at wedge:~)%

And `port select --summary` is still just Python stuff:

[60] (gr at wedge:~)% port select --summary
Name     Selected  Options
====     ========  =======
pip      pip37     pip3-apple none
pip2     none      none
pip3     none      pip3-apple none
python   none      python27 python27-apple python37 python38-apple 
python39 none
python2  none      python27 python27-apple none
python3  python37  python37 python38-apple python39 none
[61] (gr at wedge:~)% sudo port select --list perl
Warning: Unable to get active selected version: The specified group 
'perl' does not exist.
Error: The 'list' command failed: The specified group 'perl' does not exist.
[62] (gr at wedge:~)% sudo port select --list perl5
Warning: Unable to get active selected version: The specified group 
'perl5' does not exist.
Error: The 'list' command failed: The specified group 'perl5' does not 
exist.
[63] (gr at wedge:~)% sudo port select --set perl perl5.34
Selecting 'perl5.34' for 'perl' failed: The specified group 'perl' does 
not exist.
[64] (gr at wedge:~)% sudo port select --set perl5 perl5.34
Selecting 'perl5.34' for 'perl5' failed: The specified group 'perl5' 
does not exist.
[65] (gr at wedge:~)%

Does the Perl port not support version selection this way, or am I still 
not remembering the right way to do this?

For example, is the user expected to create their own perl (or perl5) group?

Shouldn't installing the port at least plug some defaults in for those 
entries?

I'm eminently aware that Perl and Python behave differently wrt module 
support, but shouldn't MacPorts at least try to provide a consistent 
interface across them?

I just did this for now:

[69] (gr at wedge:~)% sudo ln -sf /opt/local/bin/perl5.34 /opt/local/bin/perl
Password:
[70] (gr at wedge:~)% which perl
/opt/local/bin/perl
[71] (gr at wedge:~)% perl --version

This is perl 5, version 34, subversion 0 (v5.34.0) built for 
darwin-thread-multi-2level

Copyright 1987-2021, Larry Wall

Perl may be copied only under the terms of either the Artistic License 
or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

[72] (gr at wedge:~)%

But I expect that'll bite me in the ass when I upgrade the perl5 port…?

On 2022-01-20 21:57 EST, Gabriel Rosenkoetter wrote:
> I just did a `sudo port install perl5.34`, anticipating that doing so 
> would "activate" it (and the build output indicated that step was 
> taken), presumably bumping the /opt/local/bin/perl sym link to the new 
> version and… apparently that was the wrong thing to assume, since that 
> sym link no longer exists on this system?
> 
> [31] (gr at wedge:~)% which perl
> /usr/bin/perl
> [32] (gr at wedge:~)% echo $PATH
> /Users/gr/bin:/opt/local/bin:/usr/sbin:/sbin:/usr/bin:/bin:/usr/local/bin:/opt/local/sbin:/usr/libexec:/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support:/usr/local/MacGPG2/bin 
> 
> [33] (gr at wedge:~)% port installed |egrep '^ *perl5'
>    perl5.26 @5.26.3_4
>    perl5.26 @5.26.3_6 (active)
>    perl5.28 @5.28.3_1
>    perl5.28 @5.28.3_4 (active)
>    perl5.34 @5.34.0_2 (active)
> [34] (gr at wedge:~)% ls /opt/local/bin/perl*
> /opt/local/bin/perl5.26        /opt/local/bin/perldoc-5.26
> /opt/local/bin/perl5.26.3    /opt/local/bin/perldoc-5.28
> /opt/local/bin/perl5.28        /opt/local/bin/perldoc-5.34
> /opt/local/bin/perl5.28.3    /opt/local/bin/perlivp-5.26
> /opt/local/bin/perl5.34        /opt/local/bin/perlivp-5.28
> /opt/local/bin/perl5.34.0    /opt/local/bin/perlivp-5.34
> /opt/local/bin/perlbug-5.26    /opt/local/bin/perlthanks-5.26
> /opt/local/bin/perlbug-5.28    /opt/local/bin/perlthanks-5.28
> /opt/local/bin/perlbug-5.34    /opt/local/bin/perlthanks-5.34
> [35] (gr at wedge:~)%
> 
> Should Perl show up in `port --select summary`? The only ports (that I 
> have installed) that I see subscribing to that mechanism are Python:
> 
> [36] (gr at wedge:~)% port select --summary
> Name     Selected  Options
> ====     ========  =======
> pip      pip37     pip3-apple none
> pip2     none      none
> pip3     none      pip3-apple none
> python   none      python27 python27-apple python37 python38-apple 
> python39 none
> python2  none      python27 python27-apple none
> python3  python37  python37 python38-apple python39 none
> [37] (gr at wedge:~)%
> 
> I wouldn't expect any of this to change things (and it does not):
> 
> [41] (gr at wedge:~)% sudo port activate perl5.34
> --->  Computing dependencies for perl5.34
> --->  Cleaning perl5.34
> [42] (gr at wedge:~)% sudo port activate perl
> Error: port activate failed: Registry error: perl is not installed.
> [43] (gr at wedge:~)% sudo port install perl
> Error: Port perl not found
> [44] (gr at wedge:~)%
> 
> What am I forgetting here?
> 
> Has the Perl port never done that, and I've just "always" had an 
> /opt/local/bin/perl sym link I maintained manually? (If so, why'd it get 
> removed by installing a new version?)
> 


-- 
Gabriel Rosenkoetter (he/him)
gr at eclipsed.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 236 bytes
Desc: OpenPGP digital signature
URL: <http://lists.macports.org/pipermail/macports-users/attachments/20220120/d0ab7d2e/attachment.sig>


More information about the macports-users mailing list