Perl IDE output is incomplete

The Perl warning/error reporting seems to only remember the last line. This makes it pretty hard to actually locate the error’s source.

Example that happened to me in clash this morning:

use strict;
use warnings;
#use diagnostics;
use 5.20.1;

select(STDOUT); $| = 1; # DO NOT REMOVE

# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.

chomp(my $text = <STDIN>);
my $bestl = -1;
my $best;
for my $s (0 .. length($text)) {
    for $my e ($s .. length$test){
        my $l = $e - $s + 1;
        if (index($text,substr($text, $s, $l), $s+1)> 0) {
            if ($l > $bestl) {
                $best = substr($text, $s, $l);
                $bestl = $l;
            }
        }
    }
} # this is line 24
print lc($best);

See the error? Here’s what the IDE tells us about it:

syntax error at /tmp/Answer.pl line 24, near “}”

at Answer.pl. on line 24

Still haven’t found it?

Here’s what running perl locally actually says:

Scalar found where operator expected at Answer.pl line 15, near “$my $e”
(Missing operator before $e?)
“my” variable $text masks earlier declaration in same statement at Answer.pl line 17.
“my” variable $s masks earlier declaration in same statement at Answer.pl line 17.
“my” variable $l masks earlier declaration in same scope at Answer.pl line 20.
Global symbol “$my” requires explicit package name (did you forget to declare “my $my”?) at Answer.pl line 15.
syntax error at Answer.pl line 15, near "$my $e "
Global symbol “$e” requires explicit package name (did you forget to declare “my $e”?) at Answer.pl line 15.
Global symbol “$test” requires explicit package name (did you forget to declare “my $test”?) at Answer.pl line 15.
syntax error at Answer.pl line 24, near “}”
Answer.pl had compilation errors.

Line 15! The (biggest) error is line 15, not 24!

Most other programming languages report all errors at once in the IDE, not just the last line, which may even not be en entire error on its own.

Please don’t penalize just Perl. Give us all errors at once! Or at the very least restrict the Python errors to the middle line.

1 Like

We’ll look into it!

This should be fixed now

1 Like

Outstanding!

So we now have the first error instead of the last.
It is much better, but I’m curious as to why we can’t just have them all, as e.g. C++ does.