1

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)

Kev
  • 118,037
  • 53
  • 300
  • 385

1 Answers1

1

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.

stevieb
  • 9,065
  • 3
  • 26
  • 36
Kev
  • 118,037
  • 53
  • 300
  • 385
  • 1
    That's excellent! Although I use the same setup as you do extensively, I've yet to run into a situation where I needed to get console output from the debugger. – stevieb Feb 22 '17 at 18:30
  • 1
    @stevieb thanks. Yeah this thing has a kind of an interactive mode that can dump a bunch of stuff to `stdout` when not running as a cron job so I needed to see what the output looked like. Not really written any serious mission critical Perl since the 90's, IntelliJ and this camelcade plugin is making me really enjoy this. – Kev Feb 22 '17 at 18:56
  • Not only is it an extremely convenient setup, it jives perfectly with my `$job`, as a lot of that work is done in Python, and we use (licensed versions of) that software, so the cross-familiarity is very handy as well. – stevieb Feb 22 '17 at 19:00