|Think about Loose Coupling|
Handling MSWin Script Outputby kcott (Bishop)
|on Sep 10, 2019 at 08:34 UTC||Need Help??|
kcott has asked for the wisdom of the Perl Monks concerning the following question:
A quick background: I have Windows 10 with Cygwin installed; I mostly use Cygwin for command line work; I have Perl 5.30.0 installed using Perlbrew.
A quick current situation: I needed Strawberry Perl for a work project; I've just installed 5.30.0 without incident. Output from scripts varies as follows: double-clicking script in File Explorer - output to a separate window (sort of expected); calling perl ./script.pl from the command line - output appears after command (expected); calling ./script.pl from the command line - output to a separate window (unexpected).
Here's some details.
I wanted to check that the correct Perl interpreter was being used. Noting that the output window disappeared almost immediately after double-clicking in File Explorer, I added some code to handle that. Here's the script:
This all worked as expected from Cygwin:
What I got with MSWin has raised two questions.
Double-clicking on the script in File Explorer gave the correct output (in a separate window) with the expected prompt:
Running as an argument to perl from the command line still has the prompt (which I'd like to get rid of):
Running without perl returns immediately:
but a separate window has the (correct) output: