in reply to Re^2: [OT] Windows cmd.exe shell (perl.exe)
in thread [OT] Windows cmd.exe shell

LOL

perl -MConfig -MExtUtils::Embed -e " system $Config{cc}, qw/ -o interp interp.c /, ccopts(), ldopts() ; "

Replies are listed 'Best First'.
Re^4: [OT] Windows cmd.exe shell (perl.exe)
by syphilis (Archbishop) on Aug 02, 2019 at 05:12 UTC
    perl -MConfig -MExtUtils::Embed -e " system $Config{cc}, qw/ -o interp interp.c /, ccopts(), ldopts() ; "

    There's probably a fairly straightforward perl one liner to do the job - but the quoted one liner is not it.

    The problem is that ccopts() and ldopts() don't return the values we're seeking - instead they print those values to STDOUT (or STDERR, FAIK ... I haven't checked).
    So we first need to capture those outputs before we can pass them to the system call.

    In the script that I hacked up, I discovered that I needed to chomp() the ldopts() output, though not the ccopts() output.
    That seemed a bit odd, but rather than try to work out what was going on I just decided to chomp() both outputs for safety.

    Cheers,
    Rob