Help with #!/usr/bin/perl

Ryan Schmidt ryandesign at
Mon Jun 18 02:28:40 UTC 2018

On Jun 16, 2018, at 17:01, Michael wrote:

> Let's say I have a bunch of scripts that start with #!/usr/bin/perl
> There is a python_select,but not a perl_select.
> How do I avoid the out of date system Perl, which doesn't have the needed support modules, and installing those modules with Mac ports doesn't put them where the system Perl sees them.

To do this for all files in a port's destroot directory whose names end with ".pl":

post-destroot {
    fs-traverse f ${destroot} {
        if {[file extension ${f}] eq ".pl"} {
            reinplace "s|^#!/usr/bin/perl|#!${prefix}/bin/perl${perl5.major}|" ${f}

(Assuming you have properly included the perl5 1.0 portgroup, or else manually set perl5.major to the right value.)

More information about the macports-users mailing list