Search code examples
perlintellij-ideaintellij-plugin

Intellij Perl5 add Perl5 interpreter


I want to use the intellij Perl Plugin, but I cannot configure the Perl5 SDK. When I open the .pm files I get the hint "Perl5 SDK is not configured". I can click on configure and it takes me to preferences -> Languages & Frameworks -> Perl5. Here I get the following: enter image description here

At Perl5 Interpreter it says Disable Perl5 support. It's the only option in the dropdown. When I click on the gear I can choose "local" and then I can choose between "Add perlbrew Perl", "Add plenv Perl" and "Add system Perl". All options get me to the file system, but no matter which file I'm choosing nothing seems to be correct.

perl -V gives me the following:

  %ENV:
    PERL5LIB="/Users/ephan/perl5/lib/perl5"
    PERL_LOCAL_LIB_ROOT="/Users/ephan/perl5"
    PERL_MB_OPT="--install_base "/Users/ephan/perl5""
    PERL_MM_OPT="INSTALL_BASE=/Users/ephan/perl5"
  @INC:
    /Users/ephan/perl5/lib/perl5/5.30.2/darwin-thread-multi-2level
    /Users/ephan/perl5/lib/perl5/5.30.2
    /Users/ephan/perl5/lib/perl5/darwin-thread-multi-2level
    /Users/ephan/perl5/lib/perl5
    /Library/Perl/5.30/darwin-thread-multi-2level
    /Library/Perl/5.30
    /Network/Library/Perl/5.30/darwin-thread-multi-2level
    /Network/Library/Perl/5.30
    /Library/Perl/Updates/5.30.2/darwin-thread-multi-2level
    /Library/Perl/Updates/5.30.2
    /System/Library/Perl/5.30/darwin-thread-multi-2level
    /System/Library/Perl/5.30
    /System/Library/Perl/Extras/5.30/darwin-thread-multi-2level
    /System/Library/Perl/Extras/5.30

which option and which directory can I choose to make it work?


Solution

  • I tried this now on macOS 11.2.3. First I installed the community edition of IntelliJ IDEA from here. Then I opened the IDE and installed the perl plugin by choosing Intellij IDEA->Preferences->Plugins and searching for perl.

    Then, chose File->New->Project.. and then Perl5 from the list:

    enter image description here

    then clicked the Next button, and clicked the cog wheel and chose Add system Perl, then chose the file perl in directory /usr/bin :

    enter image description here

    which gave me this new view

    enter image description here

    then clicked Next and chose a name for the new project :

    enter image description here

    and finally clicked the Finish button.

    enter image description here

    Now I added a new perl script to the project by clicking File->New->Perl5 File

    enter image description here

    and selected the name and type of file from the dialog :

    enter image description here

    then typed in a simple "Hello world" script in the editor :

    enter image description here

    Then chose Run->Run.. from the menu :

    enter image description here

    and selected the test.pl run configuration from the dialog :

    enter image description here

    and that's it. It ran the script and gave the following output:

    enter image description here