develooper Front page | perl.perl5.porters | Postings from April 2023

perl's error messages are getting worse

Thread Next
From:
Paul "LeoNerd" Evans
Date:
April 13, 2023 14:15
Subject:
perl's error messages are getting worse
Message ID:
20230413151517.1683da25@shy.leonerd.org.uk
Hopefully that subject grabs some attention.

Challenge for you - in 5 seconds of looking at this output, tell me
where my error is:

String found where operator expected at process.pl line 73, near "convert "base.svg""
        (Do you need to predeclare convert?)
String found where operator expected at process.pl line 74, near "convert "base.svg""
        (Do you need to predeclare convert?)
String found where operator expected at process.pl line 75, near "convert "base.svg""
        (Do you need to predeclare convert?)
Number found where operator expected at process.pl line 80, near "page 1"
        (Do you need to predeclare page?)
Number found where operator expected at process.pl line 84, near "page 2"
        (Do you need to predeclare page?)
Number found where operator expected at process.pl line 88, near "page 3"
        (Do you need to predeclare page?)
Number found where operator expected at process.pl line 92, near "page 4"
        (Do you need to predeclare page?)
Number found where operator expected at process.pl line 96, near "page 5"
        (Do you need to predeclare page?)
Number found where operator expected at process.pl line 100, near "page 6"
        (Do you need to predeclare page?)
Global symbol "$absphoto" requires explicit package name (did you forget to declare "my $absphoto"?) at process.pl line 65.
syntax error at process.pl line 73, near "convert "base.svg""
syntax error at process.pl line 80, near "page 1"
Execution of process.pl aborted due to compilation errors.


Did ya find it?

Answer: it's this one:

  Global symbol "$absphoto" requires explicit package name (did you forget to declare "my $absphoto"?) at process.pl line 65.

It's highly nonobvious, buried in a whole bunch of errors from lines
later in the file, that nevertheless appeared earlier in the output.

So, two questions here:

  1. Why are (subsequent) later lines of error displayed before the
     actual error that really caused the problem?

  2. Why does perl continue after having found that problem on line 65?
     It goes on to erroneously attempt to compile a lot more of the
     script, which then fails and confuses the output with lots of
     collateral damage, caused by the original problem.

I think it would be good, sometime early in 5.39.x, to have a bit of a
dive into this situation and see if we can make the output a whole lot
less noisy, thus making it easier to find the actual problem.

-- 
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk      |  https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/  |  https://www.tindie.com/stores/leonerd/

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About