Search code examples
perlintellij-ideacamelcade

Is it possible to print to IntelliJ's debug console using the Camelcade Perl plugin?


I'm using IntelliJ with the Camelcade Perl plugin version 2016.3.1_10 (also known as version 2.2 in github) as served by the built-in plugin manager in IntelliJ.

Whilst debugging and testing my Perl app I'd like to be able to have the output from my print statements displayed in the debugger console tab (much like I can do with most JetBrains IDE's e.g. PHPStorm will send output from PHP echo and print statements to the debugger console).

However for some reason this isn't happening with IntelliJ and the Perl debugger plugin. All I see in the debugger console tab is:

Listening on localhost:42079...
/usr/bin/perl -I/home/kevin/appsdev/projects/automation -d:Camelcadedb /home/kevin/appsdev/projects/automation/daily_service_update.pl
Connected
(1)Connecting to the IDE from process 28238 at localhost:42079...
Connected.

All other features of the plugin work fine, e.g. setting and stopping on breakpoints, stepping through code, variable inspections etc.

I did run across this github issue which seems vaguely similar:

https://github.com/Camelcade/Perl5-IDEA/issues/1391

However the project author hasn't had a followup reply from the issue reporter.

Is there a setting in IntelliJ that I've missed to enable this capability, or is emitting output from Perl print statements to the debugger console broken?

Misc version info:

OS: Fedora 25 64bit
Perl: 5.24.1
IntelliJ: 2016.3.4 (JRE: 1.8.0_112-release-408-b6 amd64, JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o)


Solution

  • I'd completely forgotten that Perl buffers stdout, though I thought this was line buffering only; my print statements do print new lines as well.

    Adding:

    $| = 1; 
    

    ...to the top of my code ensures the output from my print statements appears in the debugger console.