Opened 5 years ago

Closed 5 years ago

#58129 closed defect (invalid)

Perl5.28 not using $PERL5LIB to populate @INC

Reported by: hyperbole (hyperbole) Owned by: mojca (Mojca Miklavec)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: perl5.28

Description (last modified by hyperbole (hyperbole))

I just used MacPorts to install perl5.28 on my MacBookPro running High Sierra (v-10.13.6). When I run perl from the terminal window in debug mode, and print @INC, I see the following:

DB<1> x @INC

0 '/Users/carlreynolds/modules'

1 '/opt/local/lib/perl5/5.28/darwin-thread-multi-2level'

2 '/opt/local/lib/perl5/5.28'

3 '/opt/local/lib/perl5/5.28/darwin-thread-multi-2level'

4 '/opt/local/lib/perl5/site_perl/5.28/darwin-thread-multi-2level'

5 '/opt/local/lib/perl5/site_perl/5.28'

6 '/opt/local/lib/perl5/vendor_perl/5.28/darwin-thread-multi-2level'

7 '/opt/local/lib/perl5/vendor_perl/5.28'

8 '/opt/local/lib/perl5/5.28/darwin-thread-multi-2level'

9 '/opt/local/lib/perl5/5.28'

However,

DB<2> x $ENV{'PERLLIB'}, $ENV{'PERL5LIB'}

0 '/Users/carlreynolds/modules:/opt/local/lib/perl5/5.28:/opt/local/lib/perl5/5.28/darwin-thread-multi-2level'

1 '/Users/carlreynolds/modules:/opt/local/lib/perl5/5.28:/opt/local/lib/perl5/5.28/darwin-thread-multi-2level'

Do you know why this version of perl is not using my definition of $PERL5LIB to set @INC? It looks to me as if @INC was compiled into perl when MacPorts installed it.

Thanks for any help you can give me,

Carl.

Change History (8)

comment:1 Changed 5 years ago by hyperbole (hyperbole)

Description: modified (diff)

comment:2 Changed 5 years ago by jmroot (Joshua Root)

Owner: set to mojca
Status: newassigned

comment:3 Changed 5 years ago by mojca (Mojca Miklavec)

Here's how it works for me:

export PERL5LIB="/tmp/a:/tmp/b"
$ perl5.28 -E 'say for @INC' 
/tmp/a
/tmp/b
/opt/local/lib/perl5/site_perl/5.28/darwin-thread-multi-2level
/opt/local/lib/perl5/site_perl/5.28
/opt/local/lib/perl5/vendor_perl/5.28/darwin-thread-multi-2level
/opt/local/lib/perl5/vendor_perl/5.28
/opt/local/lib/perl5/5.28/darwin-thread-multi-2level
/opt/local/lib/perl5/5.28

What behaviour do you expect?

comment:4 Changed 5 years ago by hyperbole (hyperbole)

I had expected to only see /tmp/a and /tmp/b in the @INC, since those are the ones that are specified in $PERL5LIB.

Does the perl installed by MacPorts automatically add all those /opt/local/lib/perl5 directories? Several of them don't exist on my machine.

comment:5 Changed 5 years ago by jmroot (Joshua Root)

perldoc -t perlrun says:

PERL5LIB    A list of directories in which to look for Perl library
                files before looking in the standard library.

The latter entries in @INC are the standard library locations. This appears to be working as intended.

comment:6 Changed 5 years ago by hyperbole (hyperbole)

Josha, Based on my understanding of your comment, it appears that the MacPorts version of perl has a list of standard directories built in and it's not possible to change that list. That is different from the behvior I've seen in perl when I installed it from other sources, which is why this behavior surprised me.

Thanks for your help. We can close this ticket.

Carl.

comment:7 Changed 5 years ago by mojca (Mojca Miklavec)

I quickly asked on the perl's IRC channel and they explained me that the behaviour is as intended, but maybe you can do some more research or show examples of how it works on some linux distrubutions. I'm not aware of us changing anything related to this, at least not intentionally.

(We do change "5.28.x" into "5.28" because otherwise a lot of things would be semi-broken or at least not exactly reproducible builds. But that should not be related.)

comment:8 Changed 5 years ago by mojca (Mojca Miklavec)

Resolution: invalid
Status: assignedclosed
Note: See TracTickets for help on using tickets.