I'm trying to use IntelliJ Idea to work on a perl script. I installed the perl plugin for IDEA as well as Strawberry Perl for Windows (10).
The syntax highlighting and other features work, but this is what happens when I try to run the program:
I'm a beginner at perl, so I'm still just using command line stuff and ASCII graphics. I was hoping to simply run, test, and debug my perl programs in IntelliJ, but the print
statement isn't putting anything in this dialog when perl runs...
I can still type stuff in the above image where the cursor is, and typing the wrong stuff can throw errors as it is supposed to. So <STDIN>
seems to be properly mapped, but <STDOUT>
is not? Or is something else wrong?
If I copy the command that it shows it is running to cmd, it works perfectly:
So is there a way to configure intellij to get <STDOUT>
in this dialog? Any help would be appreciated.
Now, following Chankey's answer, I've made a test script, and that one works:
Maybe the problem is that I imported the perl file from an external source, and IntelliJ doesn't realize it is a script, or something like that? But if I copy the code into the new file, it doesn't work either...
The test.pl had one difference: use warnings FATAL => 'all';
instead of use warnings;
. When I try this, it works until I type a string where numeric input is expected, and then prints a whole bunch of what it should have been printing all along as it quits the program:
Again, the output works fine in cmd, so I think this is an issue with IntelliJ. Any ideas? Maybe the @ symbols are creating issues? Something else? If anyone uses IDEA for windows and wants to toy around with my code, it's available on github.
Works fine for me. Below are the steps:
New
, then select Perl5 file
Script
from dropdownCTRL+SHIFT+F10
Enter
Output:
If it still does not work for you then perhaps you have not setup your Perl properly.
Go to File->Project Structure
and add perl to Project SDK
.
As per your screenshot I can see that you are using absolute path
for perl.exe
. That means you have not added perl
to your PATH
. That seems to be the issue why IntelliJ is not finding it to execute your script.
Do
set PATH=C:\Strawberry\perl\bin;%PATH%
If that also doesn't fix the issue for you then go through the wiki page of Camelcade plugin. Author has provided step by step instructions there on how to setup this plugin.