Switching to Perl 5.20 as the default Perl version

Mojca Miklavec mojca at macports.org
Fri Feb 27 01:06:20 PST 2015


On Thu, Jan 22, 2015 at 10:26 AM, Joël Brogniart wrote:
>
> Hi,
>
> Using informations from <http://trac.macports.org/ticket/46570> I tried to modify port x11/auto-multiple-choice to user perl variants. I added the lines:
>
> PortGroup               perl5 1.0
> ...
> perl5.require_variant   yes
> perl5.conflict_variants yes
> perl5.branches          5.16 5.18 5.20
> perl5.create_variants   ${perl5.branches}
>
> and changed all "port:p5.16" to "port:p${perl5.major}"
>
> All my tests where done after having "sudo port uninstall installed" before .
>
> If I do
>         sudo port install auto-multiple-choice
>         auto-multiple-choice
>
> All works fine, the application is built, installed and works.
>
> If I do
>         sudo port install perl5
>         sudo port install auto-multiple-choice
>         auto-multiple-choice
>
> All works fine too, the application is built, installed and works.
>
> But if I do
>         sudo port install perl5 +perl5_20
>         sudo port install auto-multiple-choice
>         auto-multiple-choice
> The application is built, installed but when launched I get the error:
>
> Can't locate AMC/Basic.pm in @INC (you may need to install the AMC::Basic module) (@INC contains: /opt/local/lib/perl5/site_perl/5.20/darwin-thread-multi-2level /opt/local/lib/perl5/site_perl/5.20 /opt/local/lib/perl5/vendor_perl/5.20/darwin-thread-multi-2level /opt/local/lib/perl5/vendor_perl/5.20 /opt/local/lib/perl5/5.20/darwin-thread-multi-2level /opt/local/lib/perl5/5.20 .) at /opt/local/lib/AMC/perl/AMC-gui.pl line 45.
> BEGIN failed--compilation aborted at /opt/local/lib/AMC/perl/AMC-gui.pl line 45.
>
> I get the same error when I install perl5_18. All auto-multiple-choice files stays at the same places, whatever perl variant is installed. The unreachable file is in "/opt/local/lib/perl5/vendor_perl/AMC/Basic.pm". With the default perl5 install (perl5_16), it seems that @INC contains the path "/opt/local/lib/perl5/vendor_perl' but not with perl5_18 and perl5_20.

Can you please open a new ticket about this particular issue?

One of the obvious problems with the port (even in the current state)
is that it declares dependency on p5.16-*, but then the first line of
/opt/local/bin/auto-multiple-choice executes
    #! /opt/local/bin/perl
and if that perl happens to be 5.18 or 5.20, no dependency will be met
anyway and other modules won't be found.

I believe the port needs to be modified to the extent that it will
always call "/opt/local/bin/perl5.x" rather than "/opt/local/bin/perl"
and that the .pl files will get installed to the versioned directories
rather than to "/opt/local/lib/perl5/vendor_perl".

(On the other hand we could probably easily add
"/opt/local/lib/perl5/vendor_perl" to INC path of all perl versions if
that makes life easier. I simply wasn't aware up to now that this path
was also used by some ports.)

Mojca


More information about the macports-dev mailing list