Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^6: @INC not reflecting correctly

by syphilis (Archbishop)
on Aug 28, 2021 at 04:22 UTC ( [id://11136151]=note: print w/replies, xml ) Need Help??


in reply to Re^5: @INC not reflecting correctly
in thread @INC not reflecting correctly

I still wonder about Config, though.

It's quite easy to change %Config values - and the same method works on all systems.
Just create a file named (say) New_Config.pm:
package New_Config; use Config; my $new = tied %Config; $new->{make} = 'dmake'; $new->{byteorder} = '43215678'; # Specify as many as you like 1;
Then you'll see:
C:\>perl -V:byteorder byteorder='12345678'; C:\>perl -MNew_Config -V:byteorder byteorder='43215678'; C:\>perl -V:make make='gmake'; C:\>perl -MNew_Config -V:make make='dmake';
The first I became aware of this was with Mattia Barbon's EU::FakeConfig.
This was very useful as it allowed the use of gcc toolchains to build and install XS modules on perl's built using an MSVC toolchain. (This was back in the day when ActiveState were providing perl's built using MSVC-6.0.)

I haven't checked to see whether this technique is utilised by Strawberry Perl in achieving its relocatability.
IIRC, on Windows some Config keys can be altered by editing Config.pm and Config_heavy.pl - but there are also keys that, to my knowledge, can only be changed via this "tied hash" approach.

Cheers,
Rob

Replies are listed 'Best First'.
Re^7: @INC not reflecting correctly
by haj (Vicar) on Aug 28, 2021 at 09:55 UTC
    It's quite easy to change %Config values - and the same method works on all systems. Just create a file named (say) New_Config.pm:
    You should be aware that changing paths in Config.pm has no effect on @INC. The point of the hack in ExtUtils::FakeConfig is to fool other programs about how this Perl has been built. Other programs use Config and act accordingly. For Perl itself it is just a report written at build time, the Perl executable does not read it (unless you start with perl -d as the debugger does use it).
      You should be aware that changing paths in Config.pm has no effect on @INC

      If I've said anything that implies that I was unaware of that then I've done myself a great disservice.

      Cheers,
      Rob

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11136151]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-20 02:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found