I think I solved my own question here. When perl looks for Config.pm it starts at the top of @INC and keeps on going until it finds a match. I conjecture that it's guaranteed that there is one at the ultimate path with perl-base:
$ ./2.cf.pl </usr/lib/x86_64-linux-gnu/perl/5.26> --------------- /home/bob/perl5/lib/perl5/x86_64-linux-gnu-thread-multi /home/bob/perl +5/lib/perl5 /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /us +r/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/s +hare/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 / +usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base path is /usr/lib/x86_64-linux-gnu/perl/5.26/Config.pm stat is File::stat=ARRAY(0x55f122748b70) $VAR1 = bless( [ 2054, 6591373, 33188, 1, 0, 0, 0, 3372, 1539824438, 1531923663, 1532749911, 4096, 8 ], 'File::stat' ); path is /usr/lib/x86_64-linux-gnu/perl-base/Config.pm stat is File::stat=ARRAY(0x55f122ad48c0) $VAR1 = bless( [ 2054, 6591655, 33188, 1, 0, 0, 0, 3373, 1539712704, 1531923663, 1532749916, 4096, 8 ], 'File::stat' ); $ cat 2.cf.pl #!/usr/bin/perl -w use 5.011; use utf8; use Config qw/%Config config_vars/; use Path::Tiny; use Data::Dumper; my $insarchname = $Config{'installarchlib'}; print "<$insarchname>\n"; say "---------------"; say "@INC"; foreach (@INC) { my $path1 = path( $_, "Config.pm" ); if ( -f $path1 ) { my $stat = $path1->stat; say "path is $path1"; say "stat is $stat"; say Dumper $stat; } } $
In reply to Re^3: how to get Config values into a hash
by Aldebaran
in thread how to get Config values into a hash
by Aldebaran
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |